Skip to main content

Testing Email Credentials via Command Line

Steps

  1. Convert SMTP username and password to base64.

    echo -n "SMTPUsername" | openssl enc -base64
    echo -n "SMTPPassword" | openssl enc -base64
  2. Make a .txt file and add the following content and save it.

    EHLO <email domain>
    AUTH LOGIN
    <base64 username>
    <base64 password>
    MAIL FROM: <from email address>
    RCPT TO: <to email adress>
    DATA
    From: Sender Name <from email address>
    To: <to email adress>
    Subject: SMTP Test

    This is a test message
    .
    QUIT
  3. Run the following command to send test email

    openssl s_client -crlf -quiet -starttls smtp -connect <SMTP server address>:<SMTP port> < <filename from previos step>

This should send an email to the specified email address. Any errors will be logged to the CLI.