2012-02-16 115 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