• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Mails sent via SendMail facility in Linux going to spam folder

 
Sherin Ramy
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi friends,
The emails that I have been sending via sendmail using Javamail are going into Spam folder.My username is from gmail.So it goes to other gmail users perfectly.It doesn't work with yahoo or hotmail or any other email sites.It lands in Junk.Has anyone ever come across this issue.
I have attached the code
boolean debug = false;

//Set the host smtp address
Properties props = new Properties();
//System.out.println("The localhost is"+SMTP_HOST_NAME);
//props.put("mail.smtp.host",SMTP_HOST_NAME);
props.put("mail.smtp.localhost", "*IP added here*");
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.starttls.enable", "true");


Authenticator auth = new SMTPAuthenticator();
//I have a SMPTPAuthenticator class that is used for Authentication

Session session = Session.getDefaultInstance(props, auth);
//Session session = Session.getDefaultInstance(props, null);

session.setDebug(debug);

// create a message
Message msg = new MimeMessage(session);

// set the from and to address
System.out.println("The from address is"+from);
InternetAddress addressFrom = new InternetAddress(from);
msg.setFrom(addressFrom);

InternetAddress addressTo= new InternetAddress(recipient);
System.out.println("The to address is"+recipient);
msg.setRecipient(Message.RecipientType.TO,
addressTo);



// Setting the Subject and Content Type
msg.setSubject(subject);
msg.setContent(message, "text/plain");
Transport.send(msg);





Much thanks in advance for the help.
 
Lester Burnham
Rancher
Posts: 1337
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Which SMTP server are you using? Gmail? Or are you running your own? If the latter, then the MX record of the mail server responsible for the email address you're using (Gmail) doesn't vibe with the sending mail server, and that's often seen as an indicator of spam.
 
Campbell Ritchie
Marshal
Posts: 79177
377
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
. . . and welcome to JavaRanch
 
Sherin Ramy
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the help.
 
Sherin Ramy
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Sheriff.
 
Campbell Ritchie
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're welcome
 
I'm all tasted up for a BLT! This tiny ad wants a monte cristo!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic