Wiggins d'Anconia wrote:

Scot Robnett wrote:

Is there any way to force Mail::Send to accept a "From" name, as opposed to
simply sending and using the hostname by default? I don't see anything in
the docs about setting the "From" field in the headers.


(of course, I can just open a pipe to sendmail, but I want to see if there's
a way to pull this off first...)



Definitely avoid this if possible, there are numerous mail message modules, one of them is bound to provide what you need.

Why is sendmail held in such low regard by this group?




example:

#!/usr/bin/perl -w

require Mail::Send;

my $mailbody = "blah blah blah";
my $to = '[EMAIL PROTECTED]';
my $from = '[EMAIL PROTECTED]';

my $msg = new Mail::Send;

# $msg->from($from) # doesn't work and mail
                    # doesn't get sent if you
                    # use it


It appears that 'from' isn't one of the proper header methods, you should try using the 'set' or 'add' methods to add the header you want. For instance:


$msg->set('From' => $from);

$msg->to($to);
$msg->subject('Mail from SomeBusiness.com');
my $fh = $msg->open;
print $fh $mailbody;
$fh->close;

# When this mail comes in, it comes from
# <mywebaccountuserID>@<mywebhostdomain>


If this doesn't suffice you might try one of the other mail modules that is slightly more robust.

http://danconia.org





-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to