User Tools

Site Tools


SMTP Client

Using msmtp


Name Version Dependencies Size Description
msmtp 1.6.2-11) libopenssl 39693 msmtp is an SMTP client. In the default mode, it transmits a mail to an SMTP server (for example at a free mail provider) which does the delivery. To use this program with your mail user agent (MUA), create a configuration file with your mail account(s) and tell your MUA to call msmtp instead of /usr/sbin/sendmail.


opkg install msmtp


Place your configuration in /etc/msmtprc. There is an existing default-block in the included config file so if you want to call msmtp without specifying an account, then you need to rename the existing default-block to something else.

Here is an example configuration using Fastmail's servers:

# Example for a system wide configuration file

# A system wide configuration file is optional.
# If it exists, it usually defines a default account.
# This allows msmtp to be used like /usr/sbin/sendmail.
account previous_default

# The SMTP smarthost.
host mailhub.oursite.example

# Construct envelope-from addresses of the form "user@oursite.example".
#auto_from on
#maildomain oursite.example

# Use TLS.
#tls on
#tls_trust_file /etc/ssl/certs/ca-certificates.crt

# Syslog logging with facility LOG_MAIL instead of the default LOG_USER.
syslog LOG_MAIL
#//////DEFAULT END//////

account default

from something@your-domain.tld

auth on
user something@your-domain.tld
password your-password-here

tls on
tls_starttls off

The part below #//////DEFAULT END////// contains our changes with the exception of the line account previous_default, which was originally account default.

Unless you happen to use Fastmail, replace with whatever the IMAP server address for your provider is. You might also need to enable the tls_starttls option.

Sending mail

echo -e "Subject: Test mail\n\nThis is a test \"message\"." | sendmail -f "Sender's Name <something@your-domain.tld>" recipient@destination.tld

Note that sendmail (/usr/sbin/sendmail) is a symlink to /usr/bin/msmtp.

Using mini-sendmail


Name Version Dependencies Size Description
mini-sendmail 1.3.6-4 none 5866 mini_sendmail reads its standard input up to an end-of-file and sends a copy of the message found there to all of the addresses listed. The message is sent by connecting to a local SMTP server. This means mini_sendmail can be used to send email from inside a chroot(2) area.

Installation and Configuration

opkg install mini-sendmail


mini_sendmail -p465
usage: mini_sendmail [-f<name>] [-t] [-s<server>] [-p<port>] [-T<timeout>] [-v] [address ...]

Note that there must not be a space between the option and the value; e.g. "-p 465" is incorrect.

:!: Warning! This package is probably deprecated and no longer present in the latest trunk release of "chaos calmer", Version from barrier breaker still works (tested on CC r44223), but you will have to add oldpackages repository. Example for atheros based devices (ar71xx) you can use this:

root@OpenWrt:~# vi /etc/opkg.conf

dest root /
dest ram /tmp
lists_dir ext /var/opkg-lists
option overlay_root /overlay
src/gz chaos_calmer_base
src/gz chaos_calmer_luci
src/gz chaos_calmer_management
src/gz chaos_calmer_packages
src/gz chaos_calmer_routing
src/gz chaos_calmer_telephony
# add this line to the end (in vi press a, paste the line and write using :wq keys, if you screw up, use :q! and try again):
src/gz barrier_breaker_oldpackages

root@OpenWrt:~# opkg install mini-sendmail
You can also do it the quick and dirty way (I do not recommended this!!):
root@OpenWrt:~# opkg install

1) Happens to be the latest version at the time of writing but these instruction will likely work on newer/older versions as well.
doc/howto/smtp.client.txt · Last modified: 2015/06/30 22:57 by nopefest