# SSMTP for PHP
When I was trying to send some mail using PHP function mail() it failed, because there were no postfix or sendmail configured. I didn’t need whole smtp functionality, so I installed ssmtp (extremely simple MTA to get mail off the system to a mail hub) and changed config /etc/ssmtp/ssmtp.conf
# /etc/ssmtp.conf — a config file for sSMTP sendmail.
#
# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.
root=vaidas
# The place where the mail goes. The actual machine name is required
# no MX records are consulted. Commonly mailhosts are named mail.domain.com
# The example will fit if you are in domain.com and your mailhub is so named.
mailhub=smtp.server.dom
# Example for SMTP port number 2525
# mailhub=mail.your.domain:2525
# Example for SMTP port number 25 (Standard/RFC)
# mailhub=mail.your.domain
# Example for SSL encrypted connection
# mailhub=mail.your.domain:465
# Where will the mail seem to come from?
rewriteDomain=rewrite.dom
# The full hostname
# Gentoo bug #47562
# Commenting the following line will force ssmtp to figure
# out the hostname itself.
# hostname=_HOSTNAME_
# Set this to never rewrite the "From:" line (unless not given) and to
# use that address in the "from line" of the envelope.
FromLineOverride=YES
# Use SSL/TLS to send secure messages to server.
#UseTLS=YES
# Use SSL/TLS certificate to authenticate against smtp host.
#UseTLSCert=YES
# Use this RSA certificate.
#TLSCert=/etc/ssl/certs/ssmtp.pem
From now all emails are forwarded to “smtp.server.dom”
To test ssmtp configuration you can execute such command:
