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="[email protected]"

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

1 Answer 1

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="[email protected],[email protected]"

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

$Message_Success
END_MESSAGE
share|improve this answer

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.