Skip to content

Instantly share code, notes, and snippets.

@tsunejui
Last active February 23, 2024 06:28
Show Gist options
  • Save tsunejui/d655c70f5fa69db9cf2663f506161be9 to your computer and use it in GitHub Desktop.
Save tsunejui/d655c70f5fa69db9cf2663f506161be9 to your computer and use it in GitHub Desktop.

Test SMTP Server with curl

replace <smtp-server> with your host of SMTP server

replace <username> with your username

replace <password> with your password

curl \--ssl-reqd \--url 'smtp://<smtp-server>:2525' \
--user '<username>:<password>' \
--mail-from from@example.com \
--mail-rcpt to@example.com \
--upload-file - <<EOF
From: Rex Wu <from@example.com>
To: My Inbox <to@example.com>
Subject: You are awesome!
Content-Type: multipart/alternative; boundary="boundary-string"

--boundary-string
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

If you are viewing this email in your inbox =E2=80=93 the integration works.
Now send your email using our SMTP server and integration of your choice!

Good luck! Hope it works.

--boundary-string
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

<!doctype html>
<html>
  <head>
    <meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3DUTF-8">
  </head>
  <body style=3D"font-family: sans-serif;">
    <div style=3D"display: block; margin: auto; max-width: 600px;" class=3D"main">
      <h1 style=3D"font-size: 18px; font-weight: bold; margin-top: 20px">Congrats for sending test email!</h1>
      <p>Good luck! Hope it works.</p>
    </div>
    <style>
      .main { background-color: white; }
      a:hover { border-left-width: 1em; min-height: 2em; }
    </style>
  </body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment