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 8883513
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:49:48+00:00 2026-06-14T20:49:48+00:00

I am sending email through Java using com.sun.mail.smtp.SMTPTransport . I am successful to send

  • 0

I am sending email through Java using com.sun.mail.smtp.SMTPTransport.

I am successful to send the email, but SMTPTransport not giving any error if I send the mail to invalid email address.

Is there a way to check that given mail address is exists or not?

I dont mean to check the mail address as client side, I need to check as server side.

I found many questions like this on many forums but I am not getting any proper solutions.

My Code is –

String email = "reciever@theirDomain.com";

Properties props = new Properties();
props.put("mail.smtps.host", "mail.myDomain.com");
props.put("mail.smtps.auth", "true");
Session session = Session.getInstance(props, null);

MimeMessage msg = new MimeMessage(session);
msg.setFrom(new InternetAddress("Mail Demo <my_email@myDomain.com>"));
msg.setRecipients(Message.RecipientType.TO, email);
msg.setSubject("Mail Example");
msg.setSentDate(new Date(System.currentTimeMillis()));

String txt = "Message Body";

msg.setText(txt);
SMTPTransport st = (SMTPTransport)session.getTransport("smtps");
st.connect("mail.myDomain.com","my_email@myDomain.com","password");
st.sendMessage(msg, msg.getAllRecipients());

System.out.println("ServerResponse : " + st.getLastServerResponse());

It gives output for both valid and invalid email_address :-
250 OK id=1TbWgN-0007oY-8r

Please help me to resolve the problem.
Thanks in advance.

  • 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-06-14T20:49:49+00:00Added an answer on June 14, 2026 at 8:49 pm

    Thank you all for your responses.

    I am able to solve my problem through MX Record checking .

    I used this Link to resolve the problem. May this also be useful for someone.

    Hashtable env = new Hashtable();
    env.put("java.naming.factory.initial",
                 "com.sun.jndi.dns.DnsContextFactory");
    DirContext ictx = new InitialDirContext( env );
    Attributes attrs = ictx.getAttributes
                           ( hostName, new String[] { "MX" });
    Attribute attr = attrs.get( "MX" );
    if (( attr == null ) || ( attr.size() == 0 )) {
       attrs = ictx.getAttributes( hostName, new String[] { "A" });
       attr = attrs.get( "A" );
       if( attr == null )
             throw new NamingException
                      ( "No match for name '" + hostName + "'" );
    }
    

    Thank you.

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

Sidebar

Related Questions

I am using following to send an email through ajax . It's not sending
My code for sending email through Gmail's smtp: SmtpClient client = new SmtpClient(smtp.gmail.com, 587);
I've been working with sending and receiving email through various web-mail clients using WatiN,
I am using ASP.NET Web forms and sending an automated email through our SMTP
I am using the following program for sending email through Java. When I use
I am sending email with Perl through Gmail with the help of Email::Send::SMTP::Gmail .
I am sending email through gmail, i want to send some html content, is
Possible Duplicate: Sending email in .NET through Gmail I am trying to send a
I'm following from an example of sending an email with image attachment through mail().
I'm using the following code from this answer Sending email in .NET through Gmail

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.