Score:1

Sending email with ssmtp From value issue

pk flag

I am trying to send an email from my cron script using ssmtp, the email is working fine but the "From" value is always showing Ubuntu <[email protected]> which I don't want to use because I need to use something like From="Cron Report <[email protected]>",

ssmtp.conf

#
# Config file for sSMTP sendmail
#
# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.
root=postmaster

# The place where the mail goes. The actual machine name is required no 
# MX records are consulted. Commonly mailhosts are named mail.domain.com
mailhub=####################

# Where will the mail seem to come from?
#rewriteDomain=

# The full hostname
hostname=example.com
AuthUser=####################
AuthPass==####################
FromLineOverride=NO
UseSTARTTLS=YES
#From="Cron Report <[email protected]>"


# Are users allowed to set their own From: address?
# YES - Allow the user to specify their own From: address
# NO - Use the system generated From: address
#FromLineOverride=YES

revaliases

root:[email protected]
Score:0
kr flag

Not sure how to change the settings in the config, but the below worked for me.

1). Uncomment ssmtp.conf:

FromLineOverride=YES

and in the crontab itself, specify 'from' address (not the below will send an email every 5 minutes ;):

MAILTO=<[email protected]>
MAILFROM=<[email protected]>
*/5 * * * * echo 'Test email from crontab. Skynet takes over the world!'
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.