linux - Validate Mail Status Bash Script -


i' doing this:

echo "test mail" | mail -s "subject" "some@mail.com" 

it's send ok! must validate in shell script if mail sent or not.

i don't find way validate if mail sent or not.

edit:

the validation have if return value in mail app 0

if [ "$?" = "0" ];     echo "mail enviado a: $destinatarios"  else     echo "mail no enviado a: $destinatarios" fi 

you should define "sent" means you. return status of "mail" specifies if message accepted local mta or not.

there still many things may happen prevent delivery final recipient. beginning there being no network connection on local machine , ending recipient overlooking message in his/her inbox.

mail delivery asynchronous. there mechanisms requesting delivery , read receipts, seldom work. may have better luck processing non-delivery reports. however, of them may take arbitrary time arrive.

for matter, 0 exit status of "mail" indication of successfully-sent message can reasonable effort.


Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -