Fay*_*Lam 13
我个人建议你使用我的模块Email :: Send :: SMTP :: TLS ,它可以通过Google Mail的TLS很好地工作.
谢谢.
use Email::Send;
my $mailer = Email::Send->new( {
mailer => 'SMTP::TLS',
mailer_args => [
Host => 'smtp.gmail.com',
Port => 587,
User => 'username@gmail.com',
Password => 'password',
Hello => 'fayland.org',
]
} );
use Email::Simple::Creator; # or other Email::
my $email = Email::Simple->create(
header => [
From => 'username@gmail.com',
To => 'to@mail.com',
Subject => 'Subject title',
],
body => 'Content.',
);
eval { $mailer->send($email) };
die "Error sending email: $@" if $@;
Run Code Online (Sandbox Code Playgroud)
根据评论,目前尚不清楚您是想通过Google的SMTP发送电子邮件,还是仅发送电子邮件(可能是您的Gmail帐户).您应该查看Email :: Send以及可能的Email :: Send :: Gmail.
或者,如果你真正问的是如何将电子邮件从非Gmail的某个地方移到Gmail,我使用Mail :: Box和Mail :: Box :: IMAP4 ::我的IMAP非常好运SSL后端.您可以在此处查看使用示例.
| 归档时间: |
|
| 查看次数: |
23917 次 |
| 最近记录: |