Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Im using a script that takes backup and sends status email using sendmail but the emails its sending comes with the to tag empty here is an image of it

Here is the part of the script

    #Email Settings
    Message_Success="Backup generated successfully"
    Message_Failure="Problem occured while generating Backup"

    Subject="Backup Status Mail"
    Sender_Name=Backup
    Recipients="tarun@gmail.com"

echo "Subject:$Subject\n\n$Message_Failure" | sendmail -F $Sender_Name $Recipients

echo "Subject:$Subject\n\n$Message_Success" | sendmail -F $Sender_Name $Recipients

can it be solved so that I can see who has recieved emails. Thanks.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

I'd put the recipients in the message and use sendmail's -t flag:

#Email Settings
Message_Success="Database Backup generated successfully"
Message_Failure="Problem occured while generating Database Backup please verify"
Subject="Database Backup Status Mail"
Sender_Name=DatabaseBackup
Recipients="tarun@gmail.com,user1@gmail.com"

sendmail -F $Sender_Name -it <<END_MESSAGE
To: $Recipients
Subject: $Subject

$Message_Success
END_MESSAGE
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.