Solved

JavaMail SMTP 553 sorry, that domain isn't in my list of allowed rcpthosts (#5.7.1)

Posted on 2004-04-19
5
6,643 Views
Last Modified: 2007-12-19
Hello
I've developed a JavaMail form processor for a project of mine, however I am hung up on one problem.

I am using Tomcat and I run it on my local machine to test sending an email.
I use authentication and specifically enter the username and password for the server.  It works with no problem

When I use the same program on the public WebServer I get the 553 error when I try to send to an email adddress outside the domain.
javax.mail.SendFailedException: Sending failed; nested exception is: javax.mail.SendFailedException: Invalid Addresses; nested exception is: javax.mail.SendFailedException: 553 sorry, that domain isn't in my list of allowed rcpthosts (#5.7.1)

The Webserver still uses the same authentication.  Even stranger is when I Install Outlook and send email from that same address there is no problem

Please help
What can I do?
0
Comment
Question by:LiveWire530
  • 2
  • 2
5 Comments
 
LVL 92

Expert Comment

by:objects
ID: 10864567
is your authentication getting called?
0
 

Author Comment

by:LiveWire530
ID: 10864660
Well I assume it authenticates, I see no errors with DEBUG option at the console level.
Plus I am sending 2 messages and the first one is within the domain and is also authenticated.

Below is the code:


public class LsbSmtpAuthenticator extends Authenticator {
            public PasswordAuthentication getPasswordAuthentication() {
                  return new PasswordAuthentication("fromaddr@mydomain.com", "mypassword");
            }
      }
.
.
.

Properties props = System.getProperties();
          props.put("mail.smtp.host", "mail.mydomain.com");
          props.put("mail.smtp.auth", "true");
      Authenticator auth = new LsbSmtpAuthenticator();
      javax.mail.Session Msession = javax.mail.Session.getInstance(props, auth);

      Msession.setDebug(true);
          MimeMessage automessage = new MimeMessage(Msession);
          automessage.setFrom(new InternetAddress("fromaddr@mydomain.com"));
          automessage.addRecipient(Message.RecipientType.TO, new InternetAddress("toaddr@otherdomain.com"));
          automessage.setSubject("Testing");

      MimeBodyPart ahtml = new MimeBodyPart();
            ahtml.setContent(autoHTML,"text/html");
      MimeBodyPart atext = new MimeBodyPart();
            atext.setText(autoText);
      MimeMultipart amultipart = new MimeMultipart("alternative");
      amultipart.addBodyPart(ahtml);
      amultipart.addBodyPart(atext);
      
      automessage.setContent(amultipart);
          Transport.send(automessage);
0
 
LVL 92

Expert Comment

by:objects
ID: 10864759
perhaps add some debug to your getPasswordAuthentication() method to see that it is being called.
Of get some log of the SMTP traffic.
0
 
LVL 7

Accepted Solution

by:
searlas earned 500 total points
ID: 10867419
See the information here:
http://mail.python.org/pipermail/mailman-users/2001-December/016230.html

From reading that, and your question, it seems that:
when mail originates from your local machine, it is relayed ok.
when mail originates from your public webserver it is not relayed.

Now, you don't say who hosts your public webserver, or who your isp is,
but I know that for myself, my ISP will ONLY relay email that originates
from IP addresses it controls.  If I want to send email from my webserver
I have to use a different smtp server, run by the people who host my
webserver.

So, it could just be you need to use a different mail.smtp.host (and authentication) for your webserver.

0
 

Author Comment

by:LiveWire530
ID: 10873462
The mail server I was using needed to have the webserver's IP added to to it relay list
Thanks!
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
maven project in eclipse 11 60
console vs log file 16 82
nested if has else if 13 96
Can't access image with tomcat/html 6 102
When it comes to protecting Oracle Database servers and systems, there are a ton of myths out there. Here are the most common.
There's a lot of hype surrounding blockchain technology. Here's how it works and some of the novel ways it' s now being used - including for data protection.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

837 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question