Does your script exit with 0 ?
March 5, 2024 10:49 AM, "Simon Hoffmann" <open...@list.simonhoffmann.net> wrote: > Hey list, > > in my virtual users file, I have specified an external script additionally to > delivery to mailboxes. > > emerge...@domain.tld user1,user2,|/etc/smtpd/send_sms.sh > > Local delivery to the mailboxes works fine. > The script itself is called as well as I do receive the SMS message. > > However, OpenSMTPd says "MDA exited prematurely" after calling the script, > thus > leading to a TEMPFAIL and OpenSMTPd trying again periodically. > > The only thing I could find was the following message: > > https://www.mail-archive.com/misc@openbsd.org/msg165772.html > > qoute: > mda is basically a program that reads input from stdin and exits with the > proper status to report to the mta that delivery was successful, whatever > happens in between is up to you. > > The send_sms.sh script consists of a static curl call at the moment, that > performs a > HTTP Get call to the SMS Gateway with the static text "new emergency mail > received". > I am not yet parsing sender/subject etc. > > The curl call / the SMS gateway responds with "OK" if the SMS was queued > correctly on > the SMS gateway. At first I thought that this "OK" back to stdout would > confuse > OpenSMTPd, so I catch the stdout of the curl call to a variable and just > "exit 0" if > the content of the variable is "OK". > > However, this is still not working, OpenSMTPd still complains "MDA exited > prematurely" > > Then I tried an "echo 250 OK". Still not working. > Then 250 2.6.0 Message accepted, still not working. > > Sadly, I could find nothing on the man pages as to which exit codes OpenSMTPd > expects > from an mda script. Additionally, based on the documentation available, I am > not sure > if OpenSMTPd just pipes the whole message into stdin or if OpenSMTPd expects > some > form of "smtp communication" (MAIL FROM + response, RCPT TO + response, ....) > and > thus comlains that my script exits prematurely because I have not implemented > that. > > So, long story short: how shall I modify my script so that OpenSMTPd > recognises that > the SMS Gateway received the call and has queued the SMS? > > Thanks! > > Cheers, > > Simon