archive_me1Add my vote for this tag create new tag
, view all tags

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


TWiki version: TWikiRelease01Feb2003
TWiki plugins: DefaultPlugin, EmptyPlugin, InterwikiPlugin, ...
Server OS: RedHat Enterprise Linux (9?)
Web server: Apache 1.3
Perl version: 5.8
Client OS: N/A
Web Browser: N/A

-- 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

Topic revision: r1 - 2004-07-08 - PeterThoeny
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2018 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.