Bug: Can't send mail with full "From" address
Using Net::SMTP, mailnotify does not work with a "From" address like:
TWiki Administrator <twiki-admin@somewhere.com>
.
(The full address form has been added to mailnotify notifications to lower the chance of getting caught by spam filters)
We encountered this issue on a TWiki server migration from a Solaris box to a Linux box.
Test case
- For below environment, call the mailnotify script
- Net::SMPT reports:
Illegal format: <TWiki Administrator <twiki-admin@somewhere.com>
- Notice the extra
<
in the beginning
Environment
--
PeterThoeny - 08 Jul 2004
Follow up
Fix record
For the envelop only, remove the name part from the "From" address, e.g. change
<TWiki Administrator <twiki-admin@somewhere.com>
to
twiki-admin@somewhere.com
. Keep the "From" in the mail header unchanged so that spam filters do not catch the notifications.
Fix in
SVN:
Index: Net.pm
===================================================================
--- Net.pm (revision 1564)
+++ Net.pm (working copy)
@@ -161,6 +161,7 @@
if( scalar( @arr ) ) {
$from = $arr[0];
$from =~ s/^From:\s*//io;
+ $from =~ s/.*<(.*?)>.*/$1/o; # extract "user@host" out of "Name <user@host>"
}
if( ! ( $from ) ) {
return "ERROR: Can't send mail, missing 'From:'";
--
PeterThoeny - 08 Jul 2004