作者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 => '
[email protected]',
To => '
[email protected]',
Subject =>'Subject',
Type =>'multipart/related'
);
$msg->attach(
Type => 'BINARY',
Id => 'myfile',
Path => 'path',
);
my $sender = Email::Send->new(
{ mailer => 'Gmail',
mailer_args => [
username => '
[email protected]',
password => 'password',
]
}
);
eval { $sender->send($msg->as_string) };
die "Error sending email: $@" if $@;
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 117.89.117.37
1F:推 BLUBLU:呵..十分感谢 不过小弟之前等不及先用PHPmailer解决mail的 12/08 02:15
2F:→ BLUBLU:的问题了,那真是超好用XD,不过改天再来试试perl的 3Q :) 12/08 02:16