DEV Community

Cover image for How to Test SMTP Settings under 5 Minutes
Berk
Berk

Posted on • Edited on

11 2

How to Test SMTP Settings under 5 Minutes

Overview

In this tutorial, you will see how to test SMTP settings with a tool named gomtp on Linux and macOS cli.

gomtp is a open-source and free software to test SMTP settings. You can see the source code on the Github page.

Table of Contents

  1. Install the gomtp tool.
  2. Configure the SMTP settings.
  3. Test the configuration.

Install gomtp

To install the gomtp, you can simply run the command below:

sudo curl -L -o /usr/local/bin/gomtp "https://github.com/burakberkkeskin/gomtp/releases/latest/download/gomtp-$(uname -s)-$(uname -m)" && \
sudo chmod +x /usr/local/bin/gomtp
Enter fullscreen mode Exit fullscreen mode

SMTP configuration.

To test SMTP settings, you first need to configure a yaml file.

  • Create a file named gomtp.yaml.
vim gomtp.yaml
Enter fullscreen mode Exit fullscreen mode

❗The file name must be gomtp.yaml by default.

  • Configure the SMTP settings for your needs.
##### Gmail Example #####
 username: 'from@gmail.com'
 password: 'appPassword'
 from: 'from@gmail.com'
 to: 'to@example.com'
 host: 'smtp.gmail.com'
 port: 587
 ssl: false
 tls: true
 auth: 'LOGIN'
 subject: 'Testing Email'
 body: |
   this is line 1
   This is line 2
Enter fullscreen mode Exit fullscreen mode

ℹ You can find some other example configurations under the repository.

Test the Configuration

Now it's time to test the configuration.

  • Be sure that you are in the same directory with the gomtp.yaml file you have just created previously.

  • Run the gomtp directly with no argument.

gomtp
Enter fullscreen mode Exit fullscreen mode
  • If the configuration is valid, you will see this output.
$ gomtp
Email sent successfully!
Enter fullscreen mode Exit fullscreen mode
  • If the configuration is invalid, you will see an error message that describe the problem.
$ gomtp
2023/12/21 11:44:33 535 5.7.8 Error: authentication failed: Invalid user or password! 1703148273-WiJ7lX77XKo0
Enter fullscreen mode Exit fullscreen mode

Reinvent your career. Join DEV.

It takes one minute and is worth it for your career.

Get started

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Immerse yourself in a wealth of knowledge with this piece, supported by the inclusive DEV Community—every developer, no matter where they are in their journey, is invited to contribute to our collective wisdom.

A simple “thank you” goes a long way—express your gratitude below in the comments!

Gathering insights enriches our journey on DEV and fortifies our community ties. Did you find this article valuable? Taking a moment to thank the author can have a significant impact.

Okay