Use mSMTP with Office365

Part 1: Pulse via Openconnect in Debian Buster
Part 2: Use LFTP to batch download files and then delete them on server.
Part 3: mSMTP with Office365
Part 4: The bash scripts

Howto

On Debian Buster install it with

sudo apt install -t msmtp

Now edit /etc/msmtprc

account default
host smtp.office365.com
port 587
tls on
tls_starttls on
tls_trust_file /etc/ssl/certs/ca-certificates.crt
tls_certcheck on
auth on
user user@domain.com
password "Yourpassword"
from "user@domain.com"
syslog LOG_MAIL

Now try to send a testmail

echo -e "Subject: Test Mail5\r\n\r\nThis is a test
mail, let me know if this works" |msmtp --debug --from sender@domain -t reciever@domain

Everything will be logged into /var/log/mail.log

If you want to use PHP to send mail via msmtp you also need to edit /etc/php/7.x/cli/php.ini and /etc/php/7.x/apache2/php.ini and edit sendmail_path

sendmail_path = /usr/bin/msmtp -t

Leave a comment

Your email address will not be published. Required fields are marked *