HOWTO Secure the msmtp configuration file using libsecret's secret-tool password manager store and switch from Google to Microsoft SMTP servers (Ubuntu)


Permanent location of video version:

Permanent location of text version:

Introduction and catchup

This is an evolution of "HOWTO Send an email using Gmail from a system configuration using msmtp and heirloom-mailx (Ubuntu)" that you can find at 

Libsecret's secret-tool utility

The password manager package that is being used here is called secret-tool and is part of the libsecret tools package. Documentation on this tool is available from

To save a password:

    secret-tool store  -- label=msmtp host

(when prompted type in the password you want to store)

To verify that the password has been entered correctly:

    secret-tool lookup host

Modify the /etc/msmtprc config file:

    sudo nano /etc/msmtprc

replace password line with 

    passwordeval "secret-tool lookup host"

To use Microsoft rather than Google SMTP

Check the Sync option in your outlook client for the SMTP settings. The port and server name are retrieved from here.

An app password needs to be generated from within Microsoft and stored in the secret-tool vault.

/etc/msmtprc needs to be modified to cater for Microsoft's SMTP server.

    account default

    auth on

    tls on

    tls_trust_file /etc/ssl/certs/ca-certificates.crt

    logfile /var/log/msmtp

    # outlook


    port 587

    from <account>

    user <account>

    password "secret-tool lookup host"

    # Syslog logging with facility LOG_MAIL instead of the default LOG_USER

    syslog LOG_MAIL

To test from the terminal that the email is working type the following

    echo "Hello, World! (Outlook)" | mail -s "HOWTO #2a" <recipient account>


Popular posts from this blog

20150628 Giarratana Circular

HOWTO setup OpenVPN server and client configuration files using EasyRSA

How To Reset the firmware, wifi on GoPro Hero 3, 3+ and sync it with latest version of GoPro Quik