Debugging email sending
In case email sending doesn’t work. Start with this little script to verify if your credentials and SMTP server configuration is actually proper.
# Replace with SMTP user loginUSER=support@pro6pp.nl# Replace with SMTP user login (or another email if you user is allowed to impersonate it)FROM=support@pro6pp.nl# SMTP passwordSMTP_PASS=somepass# SMTP server hostnameSERVER=sandbox.smtp.mailtrap.io# The SMTP portSMTP_PORT=2525# The e-mail address to send the test email to, replace with your email to actually receive itDEST_EMAIL=kvdb@kvdb.net
tee mail.txt <<EOFFrom: Kees <$FROM>To: Kees <$DEST_EMAIL>Subject: Zomaar evenDate: $(date -R)Message-Id: <$(date +%s).${FROM}>
Hi,Just an emailEOF
curl --ssl-reqd -vk smtp://$SERVER:$SMTP_PORT/ \ --mail-from $FROM\ --mail-rcpt $DEST_EMAIL\ --upload-file mail.txt\ --user "$USER:$SMTP_PASS"