SMTP supported tools

Published 11/15/2015 08:35:16 AM  |  Last update 5/4/2017 11:59:32 AM
Tags: smtp, php, email

Linux sSMTP

sSMTP is a program to deliver an email from a local computer to a configured mailhost (mailhub). It is not a mail server (like feature-rich mail server sendmail) and does not receive mail, expand aliases or manage a queue. One of its primary uses is for forwarding automated email (like system alerts) off your machine and to an external email address.


Installation
To install ssmtp, on DEB platforms, simply use the following command,
apt-get install ssmtp
apt-get install mailutils

Configurations
On having the installation done, configure ssmtp using the settings in:
/etc/ssmtp/ssmtp.conf
as followings,

# Config file for sSMTP sendmail
#
# catch-all email address:
# Make this empty to disable rewriting.
root=sender-email-address

# The place where the mail goes.
# MX records are consulted.
mailhub=smtp-server : smtp-server-port
AuthUser=sender-email-address
AuthPass=sender-password

# Where will the mail seem to come from?
rewriteDomain=domain-the-email-sent-from

# The full hostname, important,
# for VPS: it should be set in reverse DNS (see /etc/hosts)
hostname=domain-name-of-the-local-host

# 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
UseSTARTTLS=YES
UseTLS=YES       # secured mailbox
AuthMethod=LOGIN # oAuth used, such as Gmail

Testing

echo "email body" | mail -s "email subject" receiver-email-address

Using ssmtp with PHP mail function

  • in the php.ini file (/etc/php5/fpm/php.ini for Debian), search and set
    sendmail_path = /usr/sbin/ssmtp -t
  • Restart PHP web server
  • To test mail function at shell command prompt
    php -a
    mail('recipient-email','subject','message');

Using ssmtp with Wordpress

  • Open pluggable.php (located at wp-includes) using your text editor.
  • Replace,
    // Set to use PHP mail()
    $phpmailer->IsMail();
    with,
    $phpmailer->IsSendmail();
  • Enjoy your blog with ssmpt using any smtp-enable email account.


Please notice that SSMTP is no longer being developed. You might want to consider an alternative like MSMTP.

© 2024 blog.tinyray.com  by tinyray