Guest User

Untitled

a guest
Jan 24th, 2018
417
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. #!/usr/bin/perl
  2.  
  3. use CGI qw(:standard);
  4. use CGI::Carp qw(fatalsToBrowser);
  5. use Net::SMTP;
  6. use Email::MessageID;
  7.  
  8. $mid = Email::MessageID->new->in_brackets;
  9.  
  10. $ServerName = "mail.mydomain.com";
  11. $MailTo = "xxxxxx@gmail.com";
  12. $MailFrom = "admin@mydomain.com";
  13. $ServerAccount = "admin@mydomain.com";
  14. $ServerPwd = "myPass!";
  15.  
  16. $subject = 'My Email Subject';
  17. $body = 'My Email Body';
  18.  
  19. $smtp = Net::SMTP->new($ServerName, Hello => "mydomain.com", Timeout => 40, Debug => 1) or die "Cannot connect to $ServerName using $ServerAccount $@";
  20.  
  21. $smtp->mail($MailFrom);
  22. $smtp->to($MailTo);
  23.  
  24. $smtp->data();
  25.  
  26. $smtp->datasend("Message-ID: $midx0Dx0A n");
  27.  
  28. $smtp->datasend("To: John Smith <$MailTo> n");
  29. $smtp->datasend("From: Me <$MailFrom> n");
  30. $smtp->datasend("Subject: $subject");
  31.  
  32. $smtp->datasend("n");
  33.  
  34. $smtp->datasend($body);
  35.  
  36. $smtp->datasend("n");
  37.  
  38. $smtp->dataend();
  39.  
  40. $smtp->quit();
  41.  
  42. print $cgi->header();
  43.  
  44. print "Done!";
Add Comment
Please, Sign In to add comment