Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1059699
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T18:12:50+00:00 2026-05-16T18:12:50+00:00

I am currently doing a summer job as Java programmer. We have an application

  • 0

I am currently doing a summer job as Java programmer. We have an application where people can enter their tasks, agenda, etc. The program is a client-server program, so all data is stored on a server.

My boss asked me to make a mail notification system. For example, when a deadline of a task is near, it sends an email to the person assigned to that task.

I implemented this system in the server (which runs 24/24) using JavaMail and it works very well. But after a while (not sure how long) JavaMail stops sending mails. This is the exception I get:

...
[Mailer] enqueuing mail
[Mailer] enqueuing mail
[Mailer] enqueuing mail
[Mailer] enqueuing mail
[Mailer] enqueuing mail
[Mailer] enqueuing mail
[Mailer] enqueuing mail
...
[Mailer] flushing mail queue (10 mails)
[Mailer] exception
javax.mail.SendFailedException: Invalid Addresses;
  nested exception is:
    com.sun.mail.smtp.SMTPAddressFailedException: 553 sorry, that domain isn't in my list of allowed rcpthosts (#5.7.1)

    at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1446)
    at com.sun.mail.smtp.SMTPTransport.sendMessage(SMTPTransport.java:736)
    at javax.mail.Transport.send0(Transport.java:191)
    at javax.mail.Transport.send(Transport.java:120)
    at Server.Mailer.send(Mailer.java:119)
    at Server.Mailer.flush(Mailer.java:84)
    at Server.Mailer.run(Mailer.java:103)
    at java.util.TimerThread.mainLoop(Unknown Source)
    at java.util.TimerThread.run(Unknown Source)
Caused by: com.sun.mail.smtp.SMTPAddressFailedException: 553 sorry, that domain isn't in my list of allowed rcpthosts (#5.7.1)

    at com.sun.mail.smtp.SMTPTransport.rcptTo(SMTPTransport.java:1297)
    ... 8 more

When running longer than X hours, it keeps giving these exceptions. So I thought it was because the connection with the SMTP server timed-out. So I changed this code:

Session session = Session.getDefaultInstance(properties, authenticator);

to:

Session session = Session.getInstance(properties, authenticator);

so it would create a new session every time. I thought this would force JavaMail to reconnect to the SMTP server and then the problem would be solved. But that didn’t solve it, I still get these exceptions…

Does anyone know how to fix this?

PS: This is the code of my send function

Session session = Session.getInstance(properties, authenticator);
MimeMessage message = new MimeMessage(session);

message.setSubject(mail.getSubject());
message.setContent(mail.getHTML().toString(), "text/html");
message.setFrom(mail.getSender());
message.setRecipients(javax.mail.Message.RecipientType.TO, mail.getRecipients());

Transport.send(message);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T18:12:51+00:00Added an answer on May 16, 2026 at 6:12 pm

    I’d start with catching SMTPAddressFailedException exceptions

    try {
        Transport.send(message);
    } catch (SMTPAddressFailedException e) {
        throw new SendFailedException("Unable to send to " + mail.getRecipients(), e);
    }
    

    It could be as simple as one of your users having a typo in their email configuration, if thats the case what you should probably do is set a flag on the relevent account which will promt the user next time they login to your application to verify their email settings.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently doing a summer job and I have to extend an existing program.
I'm currently doing facebook integration and have gone through this tutorial . So far,
I am currently doing a project in which I have to request data from
I am currently doing a C# WPF application that generates a table that does
I am currently doing an android application that contains customize alert dialog. It contains
I'm currently doing a firewall management application for Django, here's the (simplified) model :
I'm currently doing integration testing on a database and I have the following sql
Currently doing a group project for college in Java. The assignment is to produce
I am currently doing a tracking application and am using Google maps fusion table
I'm doing a project over the summer that involves entirely re-writing a large application

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.