How do I send email to my Gmail account using SMTP

2019-03-10 02:09发布

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?

9条回答
孤傲高冷的网名
2楼-- · 2019-03-10 02:45

If you aren't familiar with CPAN (Comprehensive Perl Archive Network) I recommend you to bookmark that site. It contains third party (mostly well tested) libraries.

An example showing how to send emails using perl: http://www.perlfect.com/articles/sendmail.shtml

查看更多
Fickle 薄情
3楼-- · 2019-03-10 02:52

There are muliple SMTP modules on CPAN, for example Net::ESMTP. Also, sendmail very probably does use SMTP to communicate with mail servers, so what's your real reason for not wanting to use it?

查看更多
放我归山
4楼-- · 2019-03-10 02:56

As per the comment, it's not clear if you want to send email via Google's SMTP, or just send email in general (perhaps to your gmail account). You should check out Email::Send and possibly Email::Send::Gmail.

Alternatively, if what you're really asking is how do I move email from somewhere that isn't Gmail to Gmail, I've had very good luck with IMAP using Mail::Box and the Mail::Box::IMAP4::SSL backend. You can see an example of use here.

查看更多
登录 后发表回答