User Tools

Site Tools


exim4:test_sending_emails

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
exim4:test_sending_emails [2016/11/01 16:22] peterexim4: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 
 +</code> 
 + 
 +Result 
 + 
 +<code> 
 +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 
 +</code> 
 + 
 + 
 +===== Using openssl ===== 
 + 
 +<code bash> 
 +% openssl s_client -starttls smtp -connect mail.sharewiz.net:25 
 +</code> 
 + 
 +Result 
 + 
 +<code> 
 +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 
 +</code> 
 + 
 + 
 +===== Using swaks ===== 
 + 
 +<code bash> 
 +apt-get install swaks libnet-ssleay-perl 
 +</code> 
 + 
 +Test the connection: 
 + 
 +<code bash> 
 +swaks -a -tls -q HELO -s localhost -au your_user -ap '<>' 
 +</code> 
 + 
 +Result 
 + 
 +<code> 
 + === Trying localhost:25... 
 + === Connected to localhost. 
 + < 220 debianwb ESMTP Exim 4.76 Thu, 04 Aug 2011 14:22:02 +0600 
 +  -> EHLO debianwb 
 + < 250-debianwb Hello localhost [127.0.0.1] 
 + < 250-SIZE 52428800 
 + < 250-PIPELINING 
 + < 250-STARTTLS 
 + < 250 HELP 
 +  -> STARTTLS 
 + < 220 TLS go ahead 
 + === TLS started w/ cipher DHE-RSA-AES256-SHA 
 +  ~> EHLO debianwb 
 + < 250-debianwb Hello localhost [127.0.0.1] 
 + < 250-SIZE 52428800 
 + < 250-PIPELINING 
 + < 250 HELP 
 +  ~> QUIT 
 + < 221 evie closing connection 
 +</code> 
 + 
 +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: Sending a mail from command line with:
Line 37: Line 130:
  
 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. 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
 +
 +<file bash /etc/hosts>
 +123.123.123.123 smtp.sharewiz.net
 +</file>
 +
 +Save this to a PHP file, replacing test@example.com with an email address you control.
 +
 +<code php>
 +#!/usr/local/bin/php
 +<?php
 +while (true) {
 +  mail('test@example.com', 'Test email deletethiswithafilter', 'test ' . time());
 +  usleep(500000);
 +}
 +</code>
 +
 +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>
 +#!/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));
 +}
 +</code>
 +
 +
 +**NOTE**:  hosts_require_auth = * and hosts_require_tls = * also works if IPv6 support isn't needed.
  
exim4/test_sending_emails.1478017362.txt.gz · Last modified: 2020/07/15 09:30 (external edit)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki