Sendmail wrapper to send mail via SMTP

v0.2.0 2017-01-13 22:50 UTC

This package is not auto-updated.

Last update: 2021-03-06 03:00:08 UTC


Latest Stable Version Latest Unstable Version License composer.lock

Total Downloads Monthly Downloads Daily Downloads

PHP wrapper which replace default /usr/sbin/sendmail to add smtp support.

Add smtp support for basic mail function.


Download command line tool

First, download the last release of the binary:


And enable execution flag

chmod +x sendmail.phar

Check if it works by displaying version

./sendmail.phar list

Update php.ini

Edit the cli, apache or both php.ini files.

# Set the full path to the phar command line tool.
sendmail_path = "/path/to/phar/sendmail.phar"

The sendmail_path is a PHP_INI_SYSTEM changeable type which means you can only change it in the php.ini file or in the httpd.conf file.

Config file

File to store config : /etc/sendmail-smtp.yml.

You can however place the config file in another folder by specifying it in the sendmail_path value.

sendmail_path = "/path/to/phar/sendmail.phar -f /config/folder/sendmail.yml"

Full details

# SMTP hosts.
# Either a single hostname or multiple semicolon-delimited hostnames.
# You can also specify a different port
# for each host by using this format: [hostname:port]
# (e.g. ";").
# You can also specify encryption type, for example:
# (e.g. "tls://;ssl://").
# Hosts will be tried in order.

# The default SMTP server port.
port: 25

# Whether to use SMTP authentication.
# Uses the Username and Password properties.
auth: false

# SMTP username.
username: ~

# SMTP password.
password: ~

# SMTP auth type.
# Options are CRAM-MD5, LOGIN, PLAIN, NTLM, XOAUTH2, attempted in that order if not specified.
auth_type: ~

# What kind of encryption to use on the SMTP connection.
# Options: '', 'ssl' or 'tls'
secure: ~

# Whether to enable TLS encryption automatically if a server supports it,
# even if `secure` is not set to 'tls'.
# Be aware that in PHP >= 5.6 this requires that the server's certificates are valid.
auto_tls: ~

# SMTP realm.
# Used for NTLM auth
realm: ~

# SMTP workstation.
# Used for NTLM auth
workstation: ~

# The SMTP server timeout in seconds.
# Default of 5 minutes (300sec) is from RFC2821 section
timeout: 300

# Options array passed to stream_context_create when connecting via SMTP.
# @see
options: ~

# SMTP class debug output mode.
# Debug output level.
# Options:
# * `0` No output
# * `1` Commands
# * `2` Data and commands
# * `3` As 2 plus connection status
# * `4` Low-level data output
debug: 0

Sample config files


port: 587
username: mail@example.tld
password: xxxxxxxxxx
auth: true


port: 587
username: mail@example.tld
password: xxxxxxxxxx
auth: true

SMTP Server Docker

port: 8025
auth: false