How to Manually Test if an SMTP server can Receive Email


Cheap reseller Hosting


Summary:

This document will help in troubleshooting server connectivity and steps to test if MailEnable can send to remote servers. Here are two ways you can manually test if an SMTP server can receive emails:

Using Telnet:

Note: Telnet might not be enabled by default on your system. Consider alternative methods if unavailable.

Steps:

Find the MX Record:

Open a command prompt.

Type nslookup <domain_name>.

Set type to MX: set type=mx

Press Enter

The first record is the primary mail server. Note the hostname.

Connect to the Server:

Type telnet <hostname> 25. Replace <hostname> with the server name from step 1.

Send Commands:

If connected, the server will respond with a welcome message.

Send the following commands, pressing Enter after each:

HELO yourdomain.com: Introduces you.

MAIL FROM: <your_email>: Sets sender address.

RCPT TO: <recipient_email>: Sets recipient address.

DATA: Starts message content.

Type your message body (lines starting with “.” end it).

. (on a new line) to send and quit.

Analyze Responses:

Each command should receive a response code (e.g., 250 for success, 550 for error). Successful connection and message sending will show codes like 220, 250, and 354.

2. Using Online Tools:

Several online tools offer simpler testing:

These tools generally:

  • Allow entering server details and email content.
  • Send a test email and provide delivery reports.
  • Offer additional features like spam score checks.

Choosing the method:

  • Telnet offers more control and troubleshooting details.
  • Online tools are simpler and user-friendly for basic testing.

Additional tips:

  • Remember to replace placeholders like <domain_name>, <your_email>, and <recipient_email> with your actual information.
  • Be aware that some SMTP servers might not allow connections from unknown users or may require authentication.
  • If you encounter errors during the test, research the specific error code for troubleshooting.

Cheap web Hosting


How to check Postfix’s email queue and delete it .


Cheap reseller Hosting


postfix1

On this post you can check the messages in the postfix queue.

 

1- Postfix maintains two queues, the pending mails queue, and the deferred mail queue,
the differed mail queue has the mail that has soft-fail and should be retried (Temporary failure),
Postfix retries the deferred queue on set intervals (configurable, and by default 5 minutes)

 

1- Display a list of queued mail, deferred and pending

mailq

or

postqueue -p

To save the output to a text file you can run

mailq > mail.txt

or

postqueue -p > mail.txt

the above commands display all queued messages (Not the message itself but the sender and recipients and ID), The ID is particularly useful if you want to inspect the message itself.

2- View message (contents, header and body) in Postfix queue

Assuming the message has the ID XXXXXXX (you can see the ID form the QUEUE)

postcat -vq XXXXXXXXXX

Or to save it in a file

postcat -vq XXXXXXXXXX > themessage.txt

3- Tell Postfix to process the Queue now

postqueue -f

OR

postfix flush

4- Delete queued mail

Delete all queued mail

postsuper -d ALL

Delete differed mail queue messages

(The ones the system intends to retry later)

postsuper -d ALL deferred

Delete from queue selectively

To delete from the queue all emails that have a certain address in them, we can use this program (perl script)…

NOTE: This perl script seems to be free, and is all over the internet, i could not find out where it originates or who wrote it.

1- Download this file, unzip, and upload the file to your server, then from your bash command line, Change Directory to wherever you uploaded this file, for example cd /root (Just an example, You can upload it wherever you wish)

NOTE: A second script here works differently, i have not yet tested it, download it here

Now, from within that directory, execute…

./postfix-queue-delete.pl ashish@ashishkale.in

Any mail that has this email address in it’s IN or OUT list will be deleted

The script uses the postqueue -p then looks for your string, once found, it deletes the email by ID, this means that this script can delete messages using any text that appears when you run mailq (or postqueue -p), so if you run it with the parameter joe all mail with addresses such as joefriend@example.com and

Other moethods exist, like executing directly

mailq | tail +2 | grep -v '^ *(' | awk  'BEGIN { RS = "" } { if ($8 == "email@address.com" && $9 == "") print $1 } ' | tr -d '*!' | postsuper -d -

——————————–

Sample Messages in a differed mail queue

——————————–

SOME282672ID 63974 Mon Nov 29 05:12:30 someaddresss@yahoo.com
(temporary failure. Command output: maildrop: maildir over quota.)
localuser@exmple.com

———————————-

SOME282672ID 9440 Wed Jun 30 05:30:11 MAILER-DAEMON
(SomeHostName [xxx.xxx.xxx.xxx] said: 452 <username@example.org> Mailbox size limit exceeded (in reply to RCPT TO command))
username@example.org

———————————-

SOME282672ID 4171 Thu Nov 25 13:22:03 MAILER-DAEMON
(host inbound.somedomain.net [yyy.yyy.yyy.yyy] refused to talk to me: 550 Rejected: 188.xx.179.46, listed at http://csi.cloudmark.com/reset-request for remediation.)
someuser@example.com

———————————

SOME282672ID 37031 Thu Nov 25 08:53:36 someuser@example.net
(Host or domain name not found. Name service error for name=example.com type=MX: Host not found, try again)
someuser@example.com 

Cheap web Hosting