in reply to Re: Mime::Lite Sendmail Dying
in thread Mime::Lite Sendmail Dying

The email message does get sent but deamon dies.

Replies are listed 'Best First'.
Re^3: Mime::Lite Sendmail Dying
by Corion (Patriarch) on Nov 22, 2013 at 13:46 UTC

    You still don't tell us what happens when you run your mail sending code outside of your daemon.

    Searching the MIME::Lite code for the error message brings me to this snippet:

    } else { ### parent $self->print( \*SENDMAIL ); close SENDMAIL || die "error closing $p{Sendmail}: $! (exi +t $?)\n"; $return = 1; }

    ... which indicates that one workaround could be to use a method other than sendmail. For example, you could attempt direct delivery. But with that, you forego all the niceties of using an MTA, like retries, bounces etc.

    Another approach could be to simply paper over the problem by using eval:

    my $sent_ok= eval { $mail->send; 1; }; if( my $err= $@ ) { warn "Error while sending mail: '$err'"; };

    That way, your daemon will survive. Still, it remains unclear why sendmail would change behaviour in the way it appears.

      If I just run the mail sending code as a regular Perl script outside the daemon it works flawlessly. So I guess it's something with daemon. It's pretty old code, probably a good time rethink how this thing works.