4

I'm trying to develop an application that sends mail. It work well, but if i send an email from Gmail to hotmail, it's considered as spam. Here is a piece of code that describes the parameters of smtp server

Properties props = new Properties();
        props.put("mail.smtp.auth", "true");
        props.put("mail.smtp.starttls.enable", "true");
        props.put("mail.smtp.host", "smtp.gmail.com"); // pour hotmail -> smtp.live.com
        props.put("mail.smtp.port", "587");

        Session session = Session.getInstance(props,
          new javax.mail.Authenticator() {
            protected PasswordAuthentication getPasswordAuthentication() {
                return new PasswordAuthentication(emailFrom, password);
            }
          });

Any idea please ? Thank you.

Abdousoft
  • 97
  • 1
  • 3
  • 12
  • 1
    May i ask what's the emailFrom domain? i mean username@domain.com? One thing to keep in mind (among others): Make sure that the domain name in FROM part of email (i.e spam.com in spammer@spam.com) matches the MX records of spam.com domain. This is because many mail servers upon receiving the mail will do a reverse domain lookup to check if the mail indeed originated from where it claims to be originating. – F. Mayoral Sep 17 '12 at 22:14
  • Yes thank you for your clarification. The emailFrom domain name is gmail.com. – Abdousoft Sep 18 '12 at 19:45

0 Answers0