Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use Net::SMTP::TLS;
- $message = "Perl. It works, bitches!!\r\n";
- $subject = "Email from Perl";
- $recipient = "some_dude\@gmail.com"; #escape \@gmail or use single quotes
- $mailer = new Net::SMTP::TLS(
- 'smtp.gmail.com',
- Hello => 'smtp.gmail.com',
- Port => 587,
- User => 'account@gmail.com',
- Password=> 'password');
- $mailer->mail('account@gmail.com');
- $mailer->to($recipient);
- $mailer->data();
- $mailer->datasend("To: $recipient\r\n");
- $mailer->datasend("From: account\@gmail.com\r\n");
- $mailer->datasend("X-Mailer: Perl Net::SMTP\r\n");
- $mailer->datasend("Subject: $subject\r\n");
- $mailer->datasend("\r\n");
- $mailer->datasend($message);
- $mailer->dataend();
- $mailer->quit();
Add Comment
Please, Sign In to add comment