Sending mail from command line using Mutt

I use this to attach reports (pdfs, etc) to emails in my scripts. Small Perl snippet:

system("/usr/bin/mutt -i $file_with_body_content -a $file_to_attach -s "Some Random Report $report_date" $mailto < /dev/null");

And since this has now bitten me twice, make sure that there are no variables with carriage returns at the end. In my case, both times I forgot to chomp($report_date) and could not figure out why the attachments were displaying inline instead of as proper attachments when I received the email.





Please VOTE for this page at: ADD TO DEL.ICIO.US | ADD TO DIGG | ADD TO FURL | ADD TO NEWSVINE | ADD TO NETSCAPE | ADD TO REDDIT | ADD TO STUMBLEUPON | ADD TO TECHNORATI FAVORITES | ADD TO SQUIDOO | ADD TO WINDOWS LIVE | ADD TO YAHOO MYWEB | ADD TO ASK | ADD TO GOOGLE


1 Comment


  1. Nice Post

    Posted April 25, 2012, 3:49 pm

Leave a reply