cbtshare has asked for the wisdom of the Perl Monks concerning the following question:
Hello all, I am using the sendmail module in a perl script, but having a slight issue.I want to variablise the hostname but when and input that in the FROM section , but I'm getting an error
Errormy $hostname=`hostname`; sub email { my %mail = ( To => 'andr@domain.com', From => "$hostname\@domain.com", Subject => " $hash_ref->{three} ", Message => "$_[0]" ); sendmail(%mail) or die $Mail::Sendmail::error; }
Bad or missing From address: 'DataNode2 @domain.com'
If I try it without escaping the @ sign I get Possible unintended interpolation of @domain in string at aide.pl line 24. Global symbol "@domain" requires explicit package name at aide.pl line 24.
can I get assistance with this please? thank you
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Perl Script Email error
by hippo (Archbishop) on Jun 14, 2016 at 22:27 UTC | |
by choroba (Cardinal) on Jun 14, 2016 at 23:33 UTC | |
by cbtshare (Monk) on Jun 15, 2016 at 13:28 UTC |