[英]Mail::Send from address
Is there a way to define from address with Mail::Send package. 有没有一种方法可以使用Mail :: Send包从地址定义。
I tried below 我在下面尝试
my $email = new Mail::Send;
$email->from('eTEC');
but it is giving below error. 但它给出了以下错误。
Can't locate object method "from" via package "Mail::Send" at unix-mail1.pl line 11.
无法通过unix-mail1.pl第11行的包“ Mail :: Send”找到对象方法“来自”。
Regards#Mahesh 问候#Mahesh
There is nothing in the documentation for Mail::Send which indicates that it supports a from
method. Mail :: Send文档中没有任何内容表明它支持
from
方法。 So I'm not sure why you think it exists. 所以我不确定你为什么认为它存在。
In general, modules in the "Mail" namespace are older and less useful than modules in the "Email" namespace. 通常,“邮件”名称空间中的模块比“电子邮件”名称空间中的模块更旧且实用性较低。 I recommend that you look at Email::Sender (or even Email::Sender::Simple ).
我建议您查看Email :: Sender (甚至是Email :: Sender :: Simple )。
From looking at the source code, it doesn't support from()
, which means it won't support it in the constructor. 从源代码来看,它不支持
from()
,这意味着它在构造函数中将不支持它。 You need to set()
it manually which will be picked up and handled by Mail::Mailer
(part of the MailTools package) when you call open()
. 您需要手动
set()
它,当您调用open()
时,它将由Mail::Mailer
(属于MailTools包的一部分open()
。
my $email = Mail::Send->new(to => );
$email->set('From', 'eTEC');
从未使用过,但是尝试Mail::Send->new(From => 'your@email')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.