Introducing WttW Reject

Sometimes when you're developing an SMTP client, or diagnosing bounce management, or evaluating ESP bounce categorization you want to be able to send email that'll be rejected. Ideally that'll be rejected in a repeatable, controllable way.

Basics

Send mail to and it will be rejected with a 554 response after RCPT TO.

$ swaks --to reject@reject.wordtothewise.com
=== Trying mx.reject.wordtothewise.com:25...
=== Connected to mx.reject.wordtothewise.com.
<-  220 reject.wordtothewise.com ESMTP wttw email wizzard
 -> EHLO sliver
<-  250-reject.wordtothewise.com
<-  250-PIPELINING
<-  250-SIZE 10240000
<-  250-ENHANCEDSTATUSCODES
<-  250-8BITMIME
<-  250 DSN
 -> MAIL FROM:<steve@sliver>
<-  250 2.1.0 Ok
 -> RCPT TO:<reject@reject.wordtothewise.com>
<** 554 rejecting
 -> QUIT
<-  221 2.0.0 Bye
=== Connection closed with remote host.

Send mail to and it will be deferred with a 451 response after RCPT TO.

$ swaks --to defer@reject.wordtothewise.com
=== Trying mx.reject.wordtothewise.com:25...
=== Connected to mx.reject.wordtothewise.com.
<-  220 reject.wordtothewise.com ESMTP wttw email wizzard
 -> EHLO sliver
<-  250-reject.wordtothewise.com
<-  250-PIPELINING
<-  250-SIZE 10240000
<-  250-ENHANCEDSTATUSCODES
<-  250-8BITMIME
<-  250 DSN
 -> MAIL FROM:<steve@sliver>
<-  250 2.1.0 Ok
 -> RCPT TO:<defer@reject.wordtothewise.com>
<** 451 deferring
 -> QUIT
<-  221 2.0.0 Bye
=== Connection closed with remote host.

Send mail to and it will deliver successfully.

$ swaks --to discard@reject.wordtothewise.com
=== Trying mx.reject.wordtothewise.com:25...
=== Connected to mx.reject.wordtothewise.com.
<-  220 reject.wordtothewise.com ESMTP wttw email wizzard
 -> EHLO sliver
<-  250-reject.wordtothewise.com
<-  250-PIPELINING
<-  250-SIZE 10240000
<-  250-ENHANCEDSTATUSCODES
<-  250-8BITMIME
<-  250 DSN
 -> MAIL FROM:<steve@sliver>
<-  250 2.1.0 Ok
 -> RCPT TO:<discard@reject.wordtothewise.com>
<-  250 2.1.0 Ok
 -> DATA
<-  354 Go ahead
 -> Date: Fri, 15 Apr 2022 18:49:35 +0100
 -> To: discard@reject.wordtothewise.com
 -> From: steve@sliver
 -> Subject: test Fri, 15 Apr 2022 18:49:35 +0100
 -> Message-Id: <20220415184935.061800@sliver>
 -> X-Mailer: swaks v20201014.0 jetmore.org/john/code/swaks/
 ->
 -> This is a test mailing
 ->
 ->
 -> .
<-  250 2.0.0 Ok: queued
 -> QUIT
<-  221 2.0.0 Bye
=== Connection closed with remote host.

Send mail to and the SMTP session will be ungracefully closed after RCPT TO.

$ swaks --to close@reject.wordtothewise.com
=== Trying mx.reject.wordtothewise.com:25...
=== Connected to mx.reject.wordtothewise.com.
<-  220 reject.wordtothewise.com ESMTP wttw email wizzard
 -> EHLO sliver
<-  250-reject.wordtothewise.com
<-  250-PIPELINING
<-  250-SIZE 10240000
<-  250-ENHANCEDSTATUSCODES
<-  250-8BITMIME
<-  250 DSN
 -> MAIL FROM:<steve@sliver>
<-  250 2.1.0 Ok
 -> RCPT TO:<close@reject.wordtothewise.com>
*** Remote host closed connection unexpectedly.

Custom Responses

Send mail to and it will be rejected with "542 I am a custom rejection" after RCPT TO.

$ swaks --to 542_I_am_a_custom_rejection@reject.wordtothewise.com
=== Trying mx.reject.wordtothewise.com:25...
=== Connected to mx.reject.wordtothewise.com.
<-  220 reject.wordtothewise.com ESMTP wttw email wizzard
 -> EHLO sliver
<-  250-reject.wordtothewise.com
<-  250-PIPELINING
<-  250-SIZE 10240000
<-  250-ENHANCEDSTATUSCODES
<-  250-8BITMIME
<-  250 DSN
 -> MAIL FROM:<steve@sliver>
<-  250 2.1.0 Ok
 -> RCPT TO:<542_I_am_a_custom_rejection@reject.wordtothewise.com>
<** 542 I am a custom rejection
 -> QUIT
<-  221 2.0.0 Bye
=== Connection closed with remote host.

Send mail to and it will receive a multi-line rejection after RCPT TO

$ swaks --to 542_I\'m=0amultiline@reject.wordtothewise.com
=== Trying mx.reject.wordtothewise.com:25...
=== Connected to mx.reject.wordtothewise.com.
<-  220 reject.wordtothewise.com ESMTP wttw email wizzard
 -> EHLO sliver
<-  250-reject.wordtothewise.com
<-  250-PIPELINING
<-  250-SIZE 10240000
<-  250-ENHANCEDSTATUSCODES
<-  250-8BITMIME
<-  250 DSN
 -> MAIL FROM:<steve@sliver>
<-  250 2.1.0 Ok
 -> RCPT TO:<542_I'm=0amultiline@reject.wordtothewise.com>
<** 542-I'm
<** 542 multiline
 -> QUIT
<-  221 2.0.0 Bye
=== Connection closed with remote host.

The message is escaped similarly to MIME Q-encoding - "_" is translated to space and "=" followed by two hex digits will give that ascii character.

Reject At Different Times

Rejections at different points in the SMTP transaction mean different things and often should be handled differently. If you prefix any of these email address with "after_rcpt_", "after_data_", "after_dot_" or "after_quit_" the mail will be rejected after that point in the SMTP transaction.

e.g.

$ swaks --to after_dot_542_I\'m=0amultiline@reject.wordtothewise.com
=== Trying mx.reject.wordtothewise.com:25...
=== Connected to mx.reject.wordtothewise.com.
<-  220 reject.wordtothewise.com ESMTP wttw email wizzard
 -> EHLO sliver
<-  250-reject.wordtothewise.com
<-  250-PIPELINING
<-  250-SIZE 10240000
<-  250-ENHANCEDSTATUSCODES
<-  250-8BITMIME
<-  250 DSN
 -> MAIL FROM:<steve@sliver>
<-  250 2.1.0 Ok
 -> RCPT TO:<after_dot_542_I'm=0amultiline@reject.wordtothewise.com>
<-  250 2.1.0 Ok
 -> DATA
<-  354 Go ahead
 -> Date: Fri, 15 Apr 2022 19:03:23 +0100
 -> To: after_dot_542_I'm=0amultiline@reject.wordtothewise.com
 -> From: steve@sliver
 -> Subject: test Fri, 15 Apr 2022 19:03:23 +0100
 -> Message-Id: <20220415190323.063819@sliver>
 -> X-Mailer: swaks v20201014.0 jetmore.org/john/code/swaks/
 ->
 -> This is a test mailing
 ->
 ->
 -> .
<** 542-I'm
<** 542 multiline
 -> QUIT
<-  221 2.0.0 Bye
=== Connection closed with remote host.

or

$ swaks --to after_data_reject@reject.wordtothewise.com
=== Trying mx.reject.wordtothewise.com:25...
=== Connected to mx.reject.wordtothewise.com.
<-  220 reject.wordtothewise.com ESMTP wttw email wizzard
 -> EHLO sliver
<-  250-reject.wordtothewise.com
<-  250-PIPELINING
<-  250-SIZE 10240000
<-  250-ENHANCEDSTATUSCODES
<-  250-8BITMIME
<-  250 DSN
 -> MAIL FROM:<steve@sliver>
<-  250 2.1.0 Ok
 -> RCPT TO:<after_data_reject@reject.wordtothewise.com>
<-  250 2.1.0 Ok
 -> DATA
<** 554 rejecting
 -> QUIT
<-  221 2.0.0 Bye
=== Connection closed with remote host.

Testing

swaks is a great way to send test emails.

Support

If you find a bug feel free to contact us.

If you need help with anything email related we're happy to talk about consulting.