Comments on: Send email with attachment(s) from script or command line https://backreference.org/2013/05/22/send-email-with-attachments-from-script-or-command-line/ Proudly uncool and out of fashion Sat, 06 Apr 2019 13:22:59 +0000 hourly 1 https://wordpress.org/?v=5.8.2 By: waldner https://backreference.org/2013/05/22/send-email-with-attachments-from-script-or-command-line/#comment-25610 Sat, 06 Apr 2019 13:22:59 +0000 http://backreference.org/?p=3763#comment-25610 In reply to Reddy Jahnavi Tenepalli.

Without seeing what you actually typed it's impossible to help.

]]>
By: Reddy Jahnavi Tenepalli https://backreference.org/2013/05/22/send-email-with-attachments-from-script-or-command-line/#comment-25609 Sat, 06 Apr 2019 12:51:01 +0000 http://backreference.org/?p=3763#comment-25609 I used your mpack command.I'm getting too many arguments error.Can you please help

]]>
By: waldner https://backreference.org/2013/05/22/send-email-with-attachments-from-script-or-command-line/#comment-25343 Tue, 13 Mar 2018 16:19:29 +0000 http://backreference.org/?p=3763#comment-25343 In reply to Amol Aranke.

The last boundary marker should end with -- as well, eg

...
base64 "$5"

echo "--B835649000072104Jul07--";
) | sendmail -t

Don't know whether that is the problem in your case, but it's something that definitely needs fixing.

]]>
By: Amol Aranke https://backreference.org/2013/05/22/send-email-with-attachments-from-script-or-command-line/#comment-25339 Thu, 08 Mar 2018 11:55:53 +0000 http://backreference.org/?p=3763#comment-25339 I have created below script to attached a CSV File. The File is getting generated, but its truncating the header row of CSV incorrectly and also there is one more file thats getting attached with the email, namely 'ATT0001.txt' with every email. Anything wrong that you could found out here?

SCRIPT
--------------

(
echo "From:"$1;
echo "To:"$2;
echo "Subject:"$3;
echo "MIME-Version: 1.0";
echo "Content-Type:multipart/mixed; boundary=\"B835649000072104Jul07\"";

echo "--B835649000072104Jul07";
echo "Content-Type: text/html; charset=\"UTF-8\"";
echo "Content-Transfer-Encoding: 7bit";
echo "Content-Disposition: inline";
echo "";
echo "$4";

echo "--B835649000072104Jul07";
echo "Content-Type: text/csv";
echo "Content-Transfer-Encoding: base64";
echo "Content-Disposition: attachment; filename=\"$5\"";
base64 "$5"

echo "--B835649000072104Jul07";
) | sendmail -t

--------------------

]]>
By: waldner https://backreference.org/2013/05/22/send-email-with-attachments-from-script-or-command-line/#comment-25292 Fri, 09 Jun 2017 09:18:55 +0000 http://backreference.org/?p=3763#comment-25292 In reply to Miguel.

What does it mean that base64 is "not recognized"? If it's not installed, you'll have to install the package containing the program using your distribution's package manager. However it should be in the "coreutils" package (at least in recent distributions), which is almost surely guaranteed to be installed on any system. Perhaps your PATH does not include its location? Without more details on the error it's impossible to tell.

]]>