Open Means Open Means

This script is a snippet which can be used to send an text email using perl programming.

This is useful code for the Perl programmer which needs to automate the application as well email application in the script itself

Just copy the below script and modify the email body along with sender and receiver inforamtion. you should be all set.

We are using sendmail command which is present in /usr/sbin.

Script

#!/usr/bin/perl

my $EMAIL_BODY="MY EMAIL BODY";

my $EMAIL_TO="This email address is being protected from spambots. You need JavaScript enabled to view it.";

my $sendmail = "/usr/sbin/sendmail -t -v";

my $reply_to = "Reply-to: xx";

my $from = "From: xxa";

my $SUBJECT_AUX="Subject: Your Subjectn";

my $send_to = "To: ".$EMAIL_TO."n";

open(SENDMAIL, "|$sendmail") or die "Cannot open $sendmail: $!";

print SENDMAIL $send_to;

print SENDMAIL $from;

print SENDMAIL $reply_to;

print SENDMAIL $SUBJECT_AUX;

print SENDMAIL "Content-type: text/plainnn";

print SENDMAIL $EMAIL_BODY;

close(SENDMAIL);

No comments

Login to post a comment

Show
  • Create an account
  • Forgot your username?
  • Forgot your password?

Related Articles

  • Avoid Three Things When You are Emailing Your List
  • Those dangers in the finger tips
  • 15 basic tips for e-mail and Newsletter Marketing
  • About Us
  • Faqs
  • Contact Us
  • Disclaimer
  • Terms & Conditions