Communicating with Blackhole

With Python

# from smtplib import SMTP             # For sending without SSL/TLS.
from smtplib import SMTP_SSL

server = 'blackhole.io'  # Change this to your server address.
msg = '''From: <[email protected]>
To: <[email protected]>
Subject: Test email

Random test email. Some UTF-8 characters: ßæøþ'''

# smtp = SMTP(server, 25)      # For sending without SSL/TLS.
smtp = SMTP_SSL(server, 465)
smtp.sendmail('[email protected]', '[email protected]',
              msg.encode('utf-8'))

# We can send multiple messages using the same connection.
smtp.sendmail(server, '[email protected]',
              msg.encode('utf-8'))

# Quit after we're done
smtp.quit()

Supported commands/verbs & parameters


DATA

Syntax

DATA

>>> DATA
354 End data with <CR><LF>.<CR><LF>
>>> some email content
>>> .

EHLO

Syntax

EHLO domain.tld

>>> EHLO domain.tld
250-blackhole.io
250-HELP
250-PIPELINING
250-AUTH CRAM-MD5 LOGIN PLAIN
250-SIZE
250-VRFY
250-ETRN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250-SMTPUTF8
250 DSN

ETRN

Syntax

ETRN

>>> ETRN
250 Queueing started

HELO

Syntax

HELO domain.tld

>>> HELO domain.tld
250 OK

HELP

Syntax

HELP

Optional

COMMAND

>>> HELP
250 Supported commands: AUTH DATA EHLO ETRN HELO MAIL NOOP QUIT RCPT RSET
                        VRFY

>>> HELP AUTH
250 Syntax: AUTH CRAM-MD5 LOGIN PLAIN

MAIL

Syntax

MAIL FROM: <user@domain.tld>

Optional

BODY= 7BIT, 8BITMIME

Optional

SMTPUTF8

Optional

SIZE= SIZE

>>> MAIL FROM: <test@domain.tld>
250 2.1.0 OK

BODY=

>>> MAIL FROM: <test@domain.tld> BODY=7BIT
250 2.1.0 OK
>>> MAIL FROM: <test@domain.tld> BODY=8BITMIME
250 2.1.0 OK
>>> MAIL FROM: <test@domain.tld> SMTPUTF8
250 2.1.0 OK

SIZE=

You can also specify the size using the SIZE= parameter.

>>> MAIL FROM: <test@domain.tld> SIZE=82000
250 2.1.0 OK

NOOP

Syntax

NOOP

>>> NOOP
250 2.0.0 OK

QUIT

Syntax

QUIT

>>> QUIT
221 2.0.0 Goodbye

RCPT

Syntax

RCPT TO: <user@domain.tld>

>>> RCPT TO: <test@domain.tld>
250 2.1.0 OK

RSET

Syntax

RSET

>>> RSET
250 2.0.0 OK

Response codes

Accept codes

250: 2.0.0 OK: queued as MESSAGE-ID

Bounce codes

450: Requested mail action not taken: mailbox unavailable
451: Requested action aborted: local error in processing
452: Requested action not taken: insufficient system storage
458: Unable to queue message
521: Machine does not accept mail
550: Requested action not taken: mailbox unavailable
551: User not local
552: Requested mail action aborted: exceeded storage allocation
553: Requested action not taken: mailbox name not allowed
571: Blocked