My question is about sending large amounts of text in email via Gmail.
I'm working on a simple application that needs to be able to do a HTTP GET request, and send the received HTML as text using a gmail account. I believe that I am using SSMTTP to send the text via gmail, and I used perl's LWP::UserAgent
to do the GET request. When I execute my Perl code, I am getting the following error due to the large amount of text being sent:
Can't exec "/bin/sh": Argument list too long
My internet searches have found these sources:
This gives me a better understanding of the constraints, but it doesn't really solve my issue due to the following reasons:
- I cannot recompile the kernel
- I cannot "break it down into smaller pieces" using
find
or my own bash function, etc.
I am trying to get this to work as requested with large amounts of text.
Here an excerpt from my Perl code:
# Uses ssmtp to send an email
sub sendEmail{
my ($destination, $subject, $body) = @_;
#say $destination; say $subject;say $body;
# Create the bash command
my $command="echo \'$body\' | mail -s \'$subject\' $destination";
say "\nExecuting shell command: $command";
my $output = qx($command);
}
I know that ideally I shouldn't be sending emails with html text. It's what I've been asked to do, so I'm attempting to do as requested.