Philipp wrote:

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


aha! I thought so as well, but I had a brainfart and set "sleep 10" at the 
beginning
of the script, which still (obviously) does not solve the issue. 


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


No, I do not. The script is literally

#!/bin/bash

out=`curl https:/.......`

if [ $out = "OK" ]
then
    exit 0
else 
    exit 1
fi





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


makes sense when you think about 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.

*insert lightbulb here* :)

All my Testmails have worked before (probably because they were just a few 
lines of
text). I can later try to find the emergency Mail from
earlier today and insert it into the queue again. Otherwise I'll just wait for 
the
next monitoring alert :)


Thanks!

Cheers, 

Simon



> 
> Philipp
> 

-- 


--

Attachment: signature.asc
Description: PGP signature

Reply via email to