Ralf Hildebrandt:
> > >sendmail -bv root
> >
> > sure, simple :-)
> >
> > but would be nice to simply get a returncode 0/1 instead a message.
> > I assume that's what Ralf is searching.
>
> A message would be ok, since it could go back into a script via a pipe.
Choose a suitable envelope sender address:
$ sendmail -f sender -bv recipient
The result is returned to the sender address. With a suitable
transport mapping to route this address to a pipe + script, you can
parse the DSN which is in RFC-standard form.
Success looks like this:
Final-Recipient: rfc822; [email protected]
Action: deliverable
Status: 2.1.5
Remote-MTA: dns; ...
Diagnostic-Code: smtp; 250 2.1.5 Ok
All other cases are "undeliverable".
Final-Recipient: rfc822; [email protected]
Action: undeliverable
Status: 4.4.4
Diagnostic-Code: X-Postfix; connect to host[addr]:25: Operation timed out
In these cases you need the Status field to decide if the error is
permanent or temporary.
Wietse