Last active
June 27, 2020 05:57
-
-
Save jonathanrodriguezs/18a2395a7843a555ac1d111244a89632 to your computer and use it in GitHub Desktop.
Send email via Gmail SMTP (SSL)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use Email::Send::SMTP::Gmail; | |
my ($mail,$error) = Email::Send::SMTP::Gmail->new( | |
-layer => 'ssl', | |
-port => '465', | |
-smtp => 'smtp.gmail.com', | |
-login => 'john.doe@gmail.com', | |
-pass => 'password' | |
); | |
die "session error: $error" if $mail ==-1; | |
$mail->send( | |
-to => 'jane.doe@gmail.com', | |
-subject => 'Greetings', | |
-body => 'Sent from PERL', | |
-attachments => '/home/john/Documents/john.doe/test.txt' | |
); | |
$mail->bye; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment