The limit is defined in command.conf.
However, you can either increase this value by assigning maxinputs
sourcetype=foo | sendemail firstname.lastname@example.org sendcsv=true subject="more than 50000 events" maxinputs=500000
permanently increase default maxinputs value in command.conf:
# maximum data that can be passed to command (0 = no limit)
maxinputs = 500000