[2024-03-05 17:07] Simon Hoffmann <open...@list.simonhoffmann.net>
> hmm... Based on Philipps idea I have modified my script as follows:
>
>
>
> #!/bin/bash
>
> cat - > /tmp/notfallemail

Have you notice that this is racy? A better (not elegant solution) is
something like:

mail=`cat`

> from=`cat /tmp/notfallemail | head -n 50 | grep -i ^From`
> from=${from// /+}
>
> subject=`cat /tmp/notfallemail | head -n 50 | grep -i ^Subject`
> subject=${subject// /+}
>
>
> out=`curl -g 
> "https://smsgw01/cgi-bin/sms_send?text=Neue+Notfall+Email+von+$from+mit+Betreff+$subject"`
>
> exit 0
>
>
> Stdin works. The SMS message now contains the From and the Subject header. 
> However, OpenSMTPd still complains with "mda exited prematurely".

This sounds strange, are you sure that this error is produced while
using this exact version of the script?

>
> If I however change the script to the following, while the message OpenSMTPd
> complains about is still in the queue and pending
>
> #!/bin/bash
>
> cat - > /dev/null
>
> out=`curl -g "https://smsgw01/cgi-bin/sms_send?text=Neue+Notfall+Email"`
>
> exit 0
>
>
> and then issue smtpctl schedule all, then OpenSMTPd reports a successful 
> delivery and removes the mail from the queue.
>
>
> Any ideas?

A wild guess is that your fs under '/tmp' is to small and cat gets a pipe
error. Specialy when you have multible instances of your script running
this is quite hard to detect.

Philipp

Reply via email to