3

My problem is that whenever my server sends emails, the sender field gets overwritten.

From: should be: Web Site Name <admin@mywebsite.com>

But email is delivered to the address from:

World Wide Web Owner <www@mywebsite.com>

Or while sending the emails from the root in the SSH:

Charlie & <root@mywebsite.com>

My /etc/ssmtp/ssmtp.conf configuration file content:

root=postmaster@mywebsite.com
mailhub=ssl0.ovh.net:465

rewriteDomain=mywebsite.com
hostname=mywebsite.com
realname = "Web Site Name"

AuthUser=postmaster%mywebsite.com
AuthPass=removed
UseTLS=YES

How can I instruct ssmtp not to change From: fields in emails? Or just define the From: anywhere?

halfer
  • 19,824
  • 17
  • 99
  • 186
Scott
  • 5,991
  • 15
  • 35
  • 42
  • 1
    ssmtp does NOT verify the SSL/TLS certificate of the remote server on the current debian, ubuntu and redhat releases and also does NOT verify the hostname of the certificate. This is a major issue, as this effectively renders the encryption useless and your password is being transmitted alike to being plaintext and anyone can sniff it. ssmtp has had no active development since atleast 2009. So, if you care about the security of the email account you use for your servers outgoing emails, do NOT use ssmtp, but postfix (or something else) instead: unix.stackexchange.com/a/118101/72087 – Zulakis Feb 24 '16 at 10:44

2 Answers2

9

Try adding FromLineOverride=YES in your ssmtp.conf, if you don't set this the from address will be overwritten since the default value should be set to "NO".

  • YES: Allow the user to specify their own From: address
  • NO: Use the system generated From: address
dan_s
  • 461
  • 5
  • 11
  • When I set `FromLineOverride=YES` it doesn't want to send emails. – Scott Dec 03 '12 at 08:07
  • Are you sending the email from PHP script or other? Can you post the function you used? – dan_s Dec 03 '12 at 09:23
  • 1
    Well, that was my bad. It is working, but I have to specify the `From:` field at any time, because when it will be empty, email will not be send.. which is mainly what I wanted. Thanks! – Scott Dec 03 '12 at 15:43
2

If you ahve problem with working of SSMTP try use MSMTP (work for me)

cat email.txt | msmtp --account=sender@mail.com --from=sender@mail.com -t adres@mail.com
Dharman
  • 30,962
  • 25
  • 85
  • 135
Hall K
  • 164
  • 1
  • 1
  • 9