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

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -