2012-02-16 109 views
-3
use strict; 
use warnings; 
use Mail::Sender; 

$::sender = new Mail::Sender 
    {smtp => 'xx.xx.xx.xxx', from => '[email protected]'}; 

$::sender->MailFile({to => '[email protected]', 
    subject => 'Here is the file', 
    msg => "I'm sending you the list you wanted.", 
    }); 
+1

你能发布你得到的错误消息吗? – Stamm 2012-02-16 12:25:04

+2

旁注:请'我的$ var = ...'而不是'$ :: var = ...'。后者有用例,但不是这一个。 – Dallaylaen 2012-02-16 12:28:02

+0

Stamm:我没有得到这个错误...... – kanwarpal 2012-02-16 12:45:59

回答

1

您实际上不会发送任何文件。尝试使用这样的:

$::sender->MailFile({to => '[email protected]', 
    subject => 'Here is the file', 
    msg => "I'm sending you the list you wanted.", 
    file => 'full_path_to_your_attachment'}); 

Mail::Sender documentation说,file说法是强制性的。

+0

好的,但我只想发送消息我应该使用什么? – kanwarpal 2012-02-16 13:16:32

+0

我可以在这里使用Mailmsg而不是MailFile吗? – kanwarpal 2012-02-16 13:21:47

+0

@kanwarpal 是的,只需输入'$ :: sender-> MailMsg(...)'而不是'$ :: sender-> MailFile(...)' – Stamm 2012-02-16 13:24:52