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,642 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Employees depend heavily on their PCs, and new threats like ransomware make it even more critical to protect their important data.
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…

785 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