DelphiFAQ Home Search:
General :: Programming :: perl
General questions about perl.

Articles:

This list is sorted by recent document popularity (not total page views).
New documents will first appear at the bottom.
Recommended links on this topic:
Featured Article

Send an email from my perl script

Question:

How can my perl script send an email? I'm working under Linux.

Answer:

The solution below assumes that sendmail is installed as /usr/lib/sendmail. You might have to adjust the first line appropriately.

#!/usr/bin/perl
 
 
 $mailprog = '/usr/lib/sendmail';
 
 open(MAIL,"|$mailprog -t");
 
 print MAIL "To: bill_gates\@macrosoft.com\n";
 print MAIL "From: your_mother <no_reply\@family.org>\n";
 print MAIL "Subject: $subject\n\n";
 print MAIL 'This message is a test.';
 close (MAIL);
 

Generated 8:01:44 on Jan 17, 2017