Re: [問題] 有人用過Mail::Webmail::Gmail (LWP?) …
我用Email::Send::Gmail沒有問題
程式如下,請自行代換你要的欄位
#!/usr/bin/perl
use strict;
use warnings;
use Email::Send;
use Email::Send::Gmail;
use MIME::Lite;
my $msg = MIME::Lite->new(
From => 'From@gmail.com',
To => 'To@gmail.com',
Subject =>'Subject',
Type =>'multipart/related'
);
$msg->attach(
Type => 'BINARY',
Id => 'myfile',
Path => 'path',
);
my $sender = Email::Send->new(
{ mailer => 'Gmail',
mailer_args => [
username => 'username@gmail.com',
password => 'password',
]
}
);
eval { $sender->send($msg->as_string) };
die "Error sending email: $@" if $@;
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 117.89.117.37
推
12/08 02:15, , 1F
12/08 02:15, 1F
→
12/08 02:16, , 2F
12/08 02:16, 2F
討論串 (同標題文章)
完整討論串 (本文為第 2 之 2 篇):
Perl 近期熱門文章
PTT數位生活區 即時熱門文章