Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2014
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. use Email::MIME;
  2. use Email::MIME::CreateHTML;
  3. use Email::Sender::Simple qw(sendmail);
  4. use Email::Sender::Transport::SMTP qw();
  5.  
  6. my $smtpServer = $mailSMTPHost;
  7. my $smtpPort = $mailSMTPPort;
  8. my $smtpUser = $mailLogin;
  9. my $smtpPassword = $mailPwd;
  10.  
  11. my $transport = Email::Sender::Transport::SMTP->new({
  12. host => $smtpServer,
  13. port => $smtpPort,
  14. sasl_username => $smtpUser,
  15. sasl_password => $smtpPassword,
  16. });
  17.  
  18. # for Email with HTML content
  19. my $mailBody = $mailGreeting . $mailMsg . $mailSignature;
  20. my $email = Email::MIME->create_html(
  21. header => [
  22. From => $mailFrom,
  23. To => $mailTo,
  24. Cc => $mailCC,
  25. Bcc => $mailBCC,
  26. Reply => $mailReplyTo,
  27. Subject => $mailSubject
  28. ],
  29. body => $mailBody
  30. );
  31.  
  32. eval { sendmail($email, { transport => $transport }); };
  33. if ($@) {
  34. # $@ is an object of Email::Sender::Failure
  35. print $@->message;
  36. print"n".$@->code;
  37. # print "Oh no!". $@->what;
  38. } else{ print "sendmail success"; };
  39.  
  40. Parsing of undecoded UTF-8 will give garbage when decoding entities at /System/Library/Perl/Extras/5.16/darwin-thread-multi-2level/HTML/PullParser.pm line 81.
  41. failed AUTH: Command unknown: 'AUTH'
  42. 500
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement