Sign inSign up

orwa84/smtpc

By orwa84

•Updated about 2 years ago

A command-line client for SMTP in a docker container, to be used in testing SMTP services.

Image
Developer tools
0

371

orwa84/smtpc repository overview

⁠SMTP client in a docker container

Using this Docker image, you can test SMTP servers within a docker-compose application.

The SMTP CLI client is smtpc⁠, and the image is available on Docker Hub at orwa84/smtpc⁠, which is built for both Intel (amd64) and Apple Silicone (arm64) architectures.

⁠Instructions

In order to use this image to test a running SMTP service, all you need to do is to run the container temporarily within the same network as the SMTP service.

For example, assuming that the SMTP service has a DNS name of "smtpd" and runs inside of the Docker network "chat_mattermost", then one might use this image as follows:

docker run --rm -it --network chat_mattermost orwa84/smtpc

Immediately after launching the image interactively, instructions on how to use smtpc to send emails are displayed:

[Usage]

smtpc send --host hostname --port port --body-type html \
  --subject 'subject' --body '<b>HTML</b> body' \
  --from [email protected] --to [email protected]

More information on the use of smtpc can also be found on GitHub at the repo's README page⁠.

⁠Example

Using the OpenSMTPD image wodby/opensmtpd⁠, we can experiment my launching two containers, one containing the SMTP server, and the other interactively using the SMTP client to send test emails. Note that for this to work, both containers have to be within the same Docker network as follows:

docker network create mail
docker run --rm --detach --name smptpd --network mail wodby/opensmtpd
docker run --rm -it --name smtpc --network mail orwa84/smtpc
# smtpc send --host smtpd --port 25 --body-type plain --subject marhaba --body marhaba --from [email protected] --to [email protected]

Note that when trying to send test emails to gmail accounts from your local machine, these messages might be rejected by the google servers, because the IP address acquired by you is within commercial IP ranges that are not considered trustworthy.

Hence one further step in the prototyping is to perform this test on the server you plan on launching the service from. This can be done conveniently from your local machine's command prompt using the Docker context⁠ feature in Docker.

Tag summary

Content type

Image

Digest

sha256:3b33d77d2…

Size

49.8 MB

Last updated

about 2 years ago

docker pull orwa84/smtpc