Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- use CGI qw(:standard);
- use CGI::Carp qw(fatalsToBrowser);
- use Net::SMTP;
- use Email::MessageID;
- $mid = Email::MessageID->new->in_brackets;
- $ServerName = "mail.mydomain.com";
- $MailTo = "xxxxxx@gmail.com";
- $MailFrom = "admin@mydomain.com";
- $ServerAccount = "admin@mydomain.com";
- $ServerPwd = "myPass!";
- $subject = 'My Email Subject';
- $body = 'My Email Body';
- $smtp = Net::SMTP->new($ServerName, Hello => "mydomain.com", Timeout => 40, Debug => 1) or die "Cannot connect to $ServerName using $ServerAccount $@";
- $smtp->mail($MailFrom);
- $smtp->to($MailTo);
- $smtp->data();
- $smtp->datasend("Message-ID: $midx0Dx0A n");
- $smtp->datasend("To: John Smith <$MailTo> n");
- $smtp->datasend("From: Me <$MailFrom> n");
- $smtp->datasend("Subject: $subject");
- $smtp->datasend("n");
- $smtp->datasend($body);
- $smtp->datasend("n");
- $smtp->dataend();
- $smtp->quit();
- print $cgi->header();
- print "Done!";
Add Comment
Please, Sign In to add comment