zdzieblo has asked for the wisdom of the Perl Monks concerning the following question:

hi, i wonder if i'm doing something wrong or is it just a smtp server configuration problem... case scenario:

1) i'm sending an email using Email::Send
my $email_raw = Email::Simple->create( header => [ From => "somebody@somewhere.org", To => "someone@somewhere.org", Subject => "test message" ], body => "contents", ); my $sender = Email::Send->new({mailer => 'SMTP'}); $sender->mailer_args([Host => "smtp.working.one"]); $sender->send($email_raw);
2) message is being sent with no problems but in logs i can see that Email::Send have never disconnected from smtp server ie.
May 9 12:37:11 hostname postfix/smtpd[9395]: timeout after END-OF-MES +SAGE from hostname[127.0.1.1] May 9 12:37:11 hostname postfix/smtpd[9395]: disconnect from hostname +[127.0.1.1]
any help appreciated, thanks

Replies are listed 'Best First'.
Re: sending email using Email::Send
by tirwhan (Abbot) on May 09, 2008 at 12:38 UTC

    First, your example code is incorrect, because you double quote the email addresses, which makes perl try to interpolate the domain name as an array. Use q(somebody@somewhere.org) or 'somebody@somewhere.org' instead of "somebody@somewhere.org".

    But your main point is correct, Email::Send does not send the SMTP command QUIT before breaking off the connection. This appears to be a bug in Email::Send (behaves the same on my system, with the latest version of Email::Send installed) and I would encourage you to file a bug report, because this behaviour is incorrect according to RFC 2821.


    All dogma is stupid.
      yup, i should have single quoted eaddresses ... thanks for confirming it's a internal module bug...
      Hmm, so
      sub DESTROY { $SMTP->quit if $SMTP; }
      doesn't get executed (?in time)?

        No, it doesn't appear to be, adding a warning statement to the DESTROY block in Email::Send::SMTP does not result in any output.

        I'm pretty sure it's not a timeout issue either, because doing a tcpdump trace of the net traffic shows the script sending a TCP FIN packet (so it's actively closing the connection, not hanging).


        All dogma is stupid.
Re: sending email using Email::Send
by Anonymous Monk on May 09, 2008 at 12:26 UTC
    Upgrade to latest version and try again.
Re: sending email using Email::Send
by Anonymous Monk on May 09, 2008 at 12:28 UTC
    Maybe timeout is too short?