Guest User

Untitled

a guest
Jan 21st, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. use Net::SMTP::TLS;
  2.  
  3. $message = "Perl. It works, bitches!!\r\n";
  4. $subject = "Email from Perl";
  5. $recipient = "some_dude\@gmail.com"; #escape \@gmail or use single quotes
  6.  
  7. $mailer = new Net::SMTP::TLS(
  8. 'smtp.gmail.com',
  9. Hello => 'smtp.gmail.com',
  10. Port => 587,
  11. User => 'account@gmail.com',
  12. Password=> 'password');
  13. $mailer->mail('account@gmail.com');
  14. $mailer->to($recipient);
  15. $mailer->data();
  16. $mailer->datasend("To: $recipient\r\n");
  17. $mailer->datasend("From: account\@gmail.com\r\n");
  18. $mailer->datasend("X-Mailer: Perl Net::SMTP\r\n");
  19. $mailer->datasend("Subject: $subject\r\n");
  20. $mailer->datasend("\r\n");
  21. $mailer->datasend($message);
  22. $mailer->dataend();
  23. $mailer->quit();
Add Comment
Please, Sign In to add comment