package Mail::Mailer::smtp::From; use base Mail::Mailer::smtp; sub exec { my ($self, $exe, $args, $to) = @_; my %opt = @$args; my $host = $opt{Server} || undef; $opt{Debug} ||= 0; my $smtp = Net::SMTP->new($host, %opt) or return undef; if($opt{Auth}) { $smtp->auth(@{$opt{Auth}}) or return undef; } ${*$self}{sock} = $smtp; # # Adding a patch to set the From Address.. # $smtp->mail($self->mailaddress); $smtp->mail( $opt{From} ) if $opt{From}; # # End patch. # $smtp->to($_) for @$to; $smtp->data; untie *$self if tied *$self; tie *$self, 'Mail::Mailer::smtp::pipe', $self; $self; } 1;