in reply to Mime::Lite Sendmail Dying

The error message sounds to me as if /usr/bin/sendmail either does not exist, or cannot be launched by your daemon, or exits prematurely for whatever reason.

Does the mail sending code work when run outside of your daemon? If it works, then the problem is likely a permissions issue.

If the mail sending code still fails outside of your daemon, consider looking at the debug output, which can be enabled through

Debug => 1

in the constructor.

Replies are listed 'Best First'.
Re^2: Mime::Lite Sendmail Dying
by halfbaked (Sexton) on Nov 22, 2013 at 13:22 UTC
    The email message does get sent but deamon dies.

      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.