EMAIL WITH PERL & SENDMAIL

October 12, 2016 by S4

Filed under Perl

Last modified October 12, 2016

#!/usr/bin/perlprint “Content-type: text/html\n\n”;

## script author sales@s4techno.com

## script  will send mail and give the confirmation message on html.

 

$title=’Test’;$to=’abc@test.com;                      #### Receiver Mail ID $from= ‘admin@TEST.COM’;          #### Sender mail id$subject=’Test Mail’; Open(MAIL, “|/usr/sbin/sendmail –t”);   ###using the OS sendmail utility ## Mail Header print MAIL “To: $to\n”;print MAIL “From: $from\n”;print MAIL “Subject: $subject\n\n”; ## Mail Body print MAIL “Hi , This is a test mail \n”; close(MAIL);      print “<html><head><title>$title</title> </head>\n<body>\n\n”; ## HTML content to display sent mail information print “<h1>$title</h1>\n”;print “<p>A mail has been sent from $from to $to”;print “\n\n </p></body></html>”;

exit ;

Leave a Comment