Search code examples
shellunixkshmailxuuencode

Is there any way to check email sent success acknowledgement in ksh | UNIX Shell Scripting


I need to send the generated CSV files on regular intervals using script. I am using UUENCODE and mailx for the same.

But i need to know that is there any method/way to know that email sent successfully? Any kind of acknowledgement or feedback or something???

It is likely to report for any error. Also the file is confidential and is not intended to deviate to some foreign path.

Edit: Code being used for mailing.

subject="Something happened"
to="na734@company.com"
body="Attachment Test"
attachment=/home/iv315/timelog_file_150111.csv

(cat test_msg.txt; uuencode $attachment somefile.csv) | mailx -s "$subject" "$to"

Solution

  • If you are using mailx and e.g. nail from the commandline you can always use the sendwait option, which is according to the fine manual:

    sendwait

    When sending a message, wait until the mail transfer agent 
    exits before accepting further commands.     
    If the mail transfer agent returns a non-zero exit status, 
    the exit status of mailx will also be non-zero.
    

    And you can also add your mail to the To: field so if you got the message there is a chance that at least the sending process was successful.