Hi Simon

[2024-03-05 10:49] Simon Hoffmann <open...@list.simonhoffmann.net>
> 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. 

This means your script exited while OpenSMTPd still has (parts of) the
mail in the output buffer.

> [...]
>
> 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.

I would guess that you don't read stdin at all.

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

smtpd pipes the mail to stdin and expect your script to read it.

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

A simple line "cat - > /dev/null" should fix it.

Philipp

Reply via email to