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:


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

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 
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 
form of "smtp communication" (MAIL FROM + response, RCPT TO + response, ....) 
thus comlains that my script exits prematurely because I have not implemented

So, long story short: how shall I modify my script so that OpenSMTPd recognises 
the SMS Gateway received the call and has queued the SMS?




Attachment: signature.asc
Description: PGP signature

Reply via email to