作者herculus6502 (herculus6502)
看板Perl
標題Re: [問題] 有人用過Mail::Webmail::Gmail (LWP?) …
時間Mon Dec 7 17:54:53 2009
我用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
推 BLUBLU:呵..十分感謝 不過小弟之前等不及先用PHPmailer解決mail的 12/08 02:15
→ BLUBLU:的問題了,那真是超好用XD,不過改天再來試試perl的 3Q :) 12/08 02:16