User Tools

Site Tools


mail_swaks

This is an old revision of the document!


There are 2 main methods for sending/testing outgoing mail:

  • Telnet/nc
  • swaks



My favourite is using swaks as its easy to use and quick. You will probably need to install though:

SWAKS

Swaks can be found in the epel repository. Make sure you have this repo enabled and then run:

1
# yum install swaks -y


Testing your local mail server

The following command tests your local mail configuration (postfix). This includes the relay that may be configured with it.

1
swaks --to random_email@gmail.com --server 127.0.0.1 -from luke@example.com


Testing the relay host

The following command will send mail directly to the relay (for example sendgrid or mailgun).
Change “username” to the username you normally authenticate with to the relay host and you will be prompted for a password once you run the following command:

1
swaks --to random_email@gmail.com --server smtp.sendgrid.net:587 --auth-user username -tls


Telnet

Command:

1
telnet localhost 25
Response:
1
2
3
4
Trying ::1...
Connected to localhost.
Escape character is '^]'.
220 cloud-server-03.localdomain ESMTP Postfix

Command
1
HELO localhost
Response:
1
250 cloud-server-03.localdomain

Command
1
mail from: luke@localdomain.com
Response:
1
250 2.1.0 Ok

Command
1
rcpt to: luke@shirnia.com
Response:
1
2
3
250 2.1.5 Ok
data
354 End data with <CR><LF>.<CR><LF>
Type some data and then end the email with a `.` on a line by itself.
Press enter to escape and the type quit

mail_swaks.1495015695.txt.gz · Last modified: 2024/05/23 07:26 (external edit)

Except where otherwise noted, content on this wiki is licensed under the following license: Public Domain
Public Domain Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki