How to test out the SMTP Server?

I am testing my SMTP Server through wormly.com

When I do the test, I end up with

> SMTP -> FROM SERVER: 250 2.1.0 Ok RCPT TO: [email protected]
> SMTP -> FROM SERVER: 554 5.7.1 : Relay access denied SMTP -> ERROR:
> RCPT not accepted from server: 554 5.7.1 : Relay access denied

Message sending failed.

I setup my mail server with the help of this Link


This is the correct message since a third party website is connecting to your server and is not able to send out emails to external domains.

Ideally, as per the configuration, if you send an email to one of your own domains, then it should be delivered.

Had you been having an open relay, which means accepting emails for any domain, then it would be a big security risk and in no time your server would be blacklisted. It could also cause problems with your ISP for abuse.

Testing out the email server

I would highly recommend using services such as Mandrill.com to send out transactional emails rather than setting up your own server if you are inexperienced managing it. It can cause more harm than good.

However, based on your comment, you need to setup and test out your mail server. That is not a trivial task and requires testing at various levels. Try the following at the basic level:

a) Create a virtual domain, and a virtual user inside that domain

b) Do a telnet to the port 25 of your server and send a mail to that domain and see if it's delivered. You can check the error logs through tail -f /var/log/mail.log -f from a different console. Using telnet is easy

  telnet yourserver.com 25
  helo test.com
  mail from: <[email protected]>
  rcpt to: <[email protected]>
  data
  Type any content that you want, press enter, then put a period (.) and then enter to exit
  .

Now check if the email is delivered successfully through the error log. Once it's done, you'd know that incoming mails should work fine (provided A record/MX record for that domain is set correctly). Otherwise, based on the error, fix the issue.

c) Now login into the server via ssh, and use mail command to send out the email

  echo "Test Email from the new server" | mail -s "Test Subject" [email protected]

Check the spam folder of gmail as most likely, if all went well, it would have landed there. This way you would be able to check out the outgoing email.

If the java web application is residing on the same server, then you can use localhost as the email server within the application. If it is on another server, then you can enter that server's IP address under mynetworks line in postfix/main.cf, restart postfix and you can send email without authentication.

Once again, any wrong configuration can lead to misuse of the server, so be careful.