5

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: mygmailaddress@gmail.com
> 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

9

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: <test@example.com>
  rcpt to: <youruser@yourdomain.com>
  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" youruser@gmail.com

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.

  • As i am new on this so not able to get what message want to say But as i setup new mail server and i want to use it in my Java web application and i want my mail server will able to send mail to any other mail server and receive mail as well ..This is what i am expecting But when i tried with my SMTP setting i am not able to send any mail even did not get any error message – subodh Jul 9 '14 at 9:39
  • @subodh, I've updated the info to help you better test the mail server. I'd still recommend go with something like Mandrill or Mailgun. Much more reliable and save you from all the hassle. – Vivek Kapoor Jul 9 '14 at 10:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.