exim4:test_sending_emails
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
exim4:test_sending_emails [2016/11/01 16:10] – created peter | exim4:test_sending_emails [2020/07/15 09:30] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Exim4 - Test sending emails ====== | ====== Exim4 - Test sending emails ====== | ||
- | Try | + | ===== Using Telnet ===== |
+ | |||
+ | <code bash> | ||
+ | telnet localhost 25 | ||
+ | </ | ||
+ | |||
+ | Result | ||
+ | |||
+ | < | ||
+ | Trying 127.0.0.1… | ||
+ | Connected to localhost. | ||
+ | Escape character is ‘^]’. | ||
+ | 220 mail.sharewiz.net ESMTP exim | ||
+ | ehlo client | ||
+ | 250-mail.sharewiz.net | ||
+ | 250-PIPELINING | ||
+ | 250-SIZE 10240000 | ||
+ | 250-ETRN | ||
+ | 250-STARTTLS | ||
+ | 250-ENHANCEDSTATUSCODES | ||
+ | 250-8BITMIME | ||
+ | 250 DSN | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===== Using openssl ===== | ||
+ | |||
+ | <code bash> | ||
+ | % openssl s_client -starttls smtp -connect mail.sharewiz.net: | ||
+ | </ | ||
+ | |||
+ | Result | ||
+ | |||
+ | < | ||
+ | 250 DSN | ||
+ | ehlo client | ||
+ | 250-mail.sharewiz.net | ||
+ | 250-PIPELINING | ||
+ | 250-SIZE 10240000 | ||
+ | 250-ETRN | ||
+ | 250-AUTH PLAIN LOGIN | ||
+ | 250-AUTH=PLAIN LOGIN | ||
+ | 250-ENHANCEDSTATUSCODES | ||
+ | 250-8BITMIME | ||
+ | 250 DSN | ||
+ | auth login | ||
+ | 334 VXNlcm5hbWU6 | ||
+ | Y2xlbWVudEBmb3J1bWFuYWxvZ3VlLmZy | ||
+ | 334 UGFzc3dvcmQ6 | ||
+ | Q2xlbWVudDAx | ||
+ | DONE | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===== Using swaks ===== | ||
+ | |||
+ | <code bash> | ||
+ | apt-get install swaks libnet-ssleay-perl | ||
+ | </ | ||
+ | |||
+ | Test the connection: | ||
+ | |||
+ | <code bash> | ||
+ | swaks -a -tls -q HELO -s localhost -au your_user -ap '<>' | ||
+ | </ | ||
+ | |||
+ | Result | ||
+ | |||
+ | < | ||
+ | === Trying localhost: | ||
+ | === Connected to localhost. | ||
+ | < | ||
+ | -> EHLO debianwb | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | -> STARTTLS | ||
+ | < | ||
+ | === TLS started w/ cipher DHE-RSA-AES256-SHA | ||
+ | ~> EHLO debianwb | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | < | ||
+ | ~> QUIT | ||
+ | < | ||
+ | </ | ||
+ | |||
+ | Note that above we are sending an empty password while testing with the swaks tool. | ||
+ | |||
+ | |||
+ | ===== Sending a test email ===== | ||
+ | |||
+ | Sending a mail from command line with: | ||
+ | |||
+ | <code bash> | ||
+ | echo " | ||
+ | </ | ||
+ | |||
+ | or | ||
<code bash> | <code bash> | ||
Line 8: | Line 109: | ||
to see what Exim thinks should be done with a particular address, and add **-d** to the command-line to get more debugging information (but beware that there can be a lot to pick through). | to see what Exim thinks should be done with a particular address, and add **-d** to the command-line to get more debugging information (but beware that there can be a lot to pick through). | ||
+ | |||
+ | |||
+ | ===== Check the logs for success ===== | ||
+ | |||
+ | Succesful logs would have something like | ||
+ | |||
+ | <file bash> | ||
+ | 2011-01-01 20:45:24 1PZ7OG-0001Vp-Rx <= root@gustav U=root P=local S=360 | ||
+ | 2011-01-01 20:45:26 1PZ7OG-0001Vp-Rx => foo.bar@gmail.com R=dnslookup T=remote_smtp H=gmail-smtp-in.l.google.com [209.85.229.27] X=TLS1.0: | ||
+ | 2011-01-01 20:45:26 1PZ7OG-0001Vp-Rx Completed | ||
+ | </ | ||
+ | |||
+ | Unsuccessful logs would have something like: | ||
+ | |||
+ | <file bash> | ||
+ | 2011-01-01 20:50:08 1PZ7Sq-0001X9-L4 <= <> R=1PZ7Sq-0001X7-Jo U=Debian-exim P=local S=1780 | ||
+ | 2011-01-01 20:50:11 1PZ7Sq-0001X9-L4 => newsletter@foo.bar R=dnslookup T=remote_smtp H=mx1.emailsrvr.com [98.129.184.3] X=TLS1.0: | ||
+ | 2011-01-01 20:50:11 1PZ7Sq-0001X9-L4 Completed | ||
+ | </ | ||
+ | |||
+ | The **R=** is saying that this item is a bounce and the message-id given in the R= part is the original message-id which failed. | ||
+ | |||
+ | |||
+ | ===== Using a PHP script ===== | ||
+ | |||
+ | IPs may be different so run **dig smtp.sharewiz.net** and use the IPs it returns instead. | ||
+ | |||
+ | Add this to bind or into /etc/hosts | ||
+ | |||
+ | <file bash / | ||
+ | 123.123.123.123 smtp.sharewiz.net | ||
+ | </ | ||
+ | |||
+ | Save this to a PHP file, replacing test@example.com with an email address you control. | ||
+ | |||
+ | <code php> | ||
+ | # | ||
+ | <?php | ||
+ | while (true) { | ||
+ | mail(' | ||
+ | usleep(500000); | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | If the earlier **dig** command returned multiple IPs then save this to a PHP file and run it while the above is running also. Every 5ms - 15ms it will toggle the entry in the hosts file for smtp.sharewiz.net between the two IPs that it resolves to for example 123.123.123.123 and 234.234.234.234. | ||
+ | |||
+ | <code php> | ||
+ | # | ||
+ | <?php | ||
+ | while (true) { | ||
+ | passthru(' | ||
+ | usleep(10000 + rand(-5000, | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | |||
+ | **NOTE**: | ||
+ |
exim4/test_sending_emails.1478016621.txt.gz · Last modified: 2020/07/15 09:30 (external edit)