I don't want to use sendmail to send an email but would prefer to use SMTP. How can I use Perl to send an email to my GMAIL account?
相关问题
- Django & Amazon SES SMTP. Cannot send email
- $ENV{$variable} in perl
- Is it possible to pass command-line arguments to @
- Redirecting STDOUT and STDERR to a file, except fo
- Change first key of multi-dimensional Hash in perl
相关文章
- c#发送邮件,附件损坏
- How do I make a forward e-mail link?
- Running a perl script on windows without extension
- Comparing speed of non-matching regexp
- Can NOT List directory including space using Perl
- Extracting columns from text file using Perl one-l
- com.sun.mail.smtp.SMTPSenderFailedException: 550 5
- Lazy (ungreedy) matching multiple groups using reg
Another possibility you might want to look at is using the Email::Send::Gmail module from CPAN. This will allow you to send email from your Gmail account to any account (for example, to yourself)
Email::Send (as used in Fayland Lam's answer) is deprecated:
This works for me, using the preferred Email::Sender:
If you just don't like sendmail, another option is to use Postfix, another MTA.
Here are the instructions I followed to get it setup on my machine, using gmail: http://souptonuts.sourceforge.net/postfix_tutorial.html
This might be useful too, if you get a warning about failing to verify a certificate from Thawte Premium Server CA. http://ubuntuforums.org/archive/index.php/t-894355.html
personally I would suggest you to use my module Email::Send::SMTP::TLS which works pretty well through the TLS of Google Mail.
Thanks.
I've always used and had very good luck with Mail::Sender.
I happen to use
MIME::Lite
, which is a wrapper aroundNet::SMTP
to simplify the process of building email objects, file attachments, and sending the payload.If you're not familiar with installing modules, check:
On Windows, use the ActiveState Perl Package Manager (in start menu)
On Unix, use CPAN:
$ sudo cpan Module::Name
On hosted Unix accounts: How can I install a CPAN module into a local directory?