Forum OpenACS Q&A: Re: Sending Emails via SMTP port 587

Collapse
Posted by Tyge Cawthon on
Thank you for the information.
Code from GitHub. Looking at the nssmtpd.c code, we could not find any code referencing ID/password for authentication.

Sharing information
here is a bash script we use to test communications to our email server.
#!/bin/bash

server="smtp.hostname.com"
port=587
username="username"
password="password_here"
from="mailto:info@hostname.com";
to="mailto:user@anotherhostname.com";
subject="Test Email"
message="Test email sent from hostname.com:/path/mail587 bash script using OpenSSL."

# Encode username and password in base64
b64_username=$(echo -n ${username} | base64)
b64_password=$(echo -n ${password} | base64)

# Establish connection and send email
{
echo "EHLO ${server}"
sleep 1
echo "STARTTLS"
sleep 1
echo "AUTH LOGIN"
sleep 1
echo "${b64_username}"
sleep 1
echo "${b64_password}"
sleep 1
echo "MAIL FROM:<${from}>"
sleep 1
echo "RCPT TO:<${to}>"
sleep 1
echo "DATA"
sleep 1
echo "Subject: ${subject}"
echo
echo "${message}"
echo "."
sleep 1
echo "QUIT"
} | openssl s_client -starttls smtp -connect ${server}:${port} -crlf -ign_eof

Have a good weekend.