User Tools

Site Tools


exim4:test_sending_emails

This is an old revision of the document!


Exim4 - Test sending emails

Try

Sending a mail from command line with:

echo "Test" | mail -s Testmail foo.bar@gmail.com

or

exim -bt recipient@address

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

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:RSA_ARCFOUR_MD5:16 DN="C=US,ST=California,L=Mountain View,O=Google Inc,CN=mx.google.com"
2011-01-01 20:45:26 1PZ7OG-0001Vp-Rx Completed

Unsuccessful logs would have something like:

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:RSA_AES_256_CBC_SHA1:32 DN="C=US,O=mx1.emailsrvr.com,OU=GT21850092,OU=See www.geotrust.com/resources/cps (c)08,OU=Domain Control Validated - QuickSSL(R),CN=mx1.emailsrvr.com"
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. You'll need to look at the log-entry for that to see what recipient address was generated and why it 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

/etc/hosts
123.123.123.123 smtp.sharewiz.net

Save this to a PHP file, replacing test@example.com with an email address you control.

#!/usr/local/bin/php
<?php
while (true) {
  mail('test@example.com', 'Test email deletethiswithafilter', 'test ' . time());
  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.

#!/usr/local/bin/php
<?php
while (true) {
  passthru('new_hosts_file_contents=`cat /etc/hosts | sed \'s/123.123.123.123/ip123/g\' | sed \'s/234.234.234.234/ip234/g\' | sed \'s/ip123/234.234.234.234/g\' | sed \'s/ip234/123.123.123.123/g\'`; echo "$new_hosts_file_contents" > /etc/hosts 2>&1');
        usleep(10000 + rand(-5000,5000));
}

NOTE: hosts_require_auth = * and hosts_require_tls = * also works if IPv6 support isn't needed.

exim4/test_sending_emails.1478090670.txt.gz · Last modified: 2020/07/15 09:30 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki