This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Cloud Application Architecture Patterns: Designing, Building, and Modernizing for the Cloud and have Kyle Brown, Bobby Woolf and Joseph Yodor on-line!
See this thread for details.
  • 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
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

JavaMail e-mail goes to Junk E-mail

 
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
E-mail from my application directly goes to Junk e-mail. I am using Microsoft Outlook which is connected to Microsoft exchange. Dumb solution here is mark the first e-mail as Not Spam and then onwards it directly goes to Inbox.

Can anyone here know how to rectify this problem.
 
Marshal
Posts: 28425
102
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That means that the server which receives the e-mail thinks it looks like spam. The solution, then, would be to try to make your e-mail look less like spam.

It's hard to say how you might do that when we don't know anything about how you're formatting or sending your e-mails. So all I can suggest at this point is that you should research how anti-spam products work and act accordingly.
 
Vivek Alampally
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for your reply.
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try With this Code


String from = "[email protected]";
String to = "[email protected]";
// SUBSTITUTE YOUR ISP'S MAIL SERVER HERE!!!
String host = "your host ";

// Create properties, get Session
Properties props = new Properties();

// If using static Transport.send(),
// need to specify which host to send it to
props.put("mail.smtp.host", host);
// To see what is going on behind the scene
props.put("mail.debug", "true");
Session session = Session.getInstance(props);

try {
// Instantiatee a message
Message msg = new MimeMessage(session);

//Set message attributes
msg.setFrom(new InternetAddress(from));
InternetAddress[] address = {new InternetAddress(to)};
msg.setRecipients(Message.RecipientType.TO, address);
msg.setSubject("ONLINE SHOPPING DETAILS ");
msg.setSentDate(new Date());




}
msg.setContent("<h1> Online Shopping Details</h1>", "text/html");


//Send the message
Transport.send(msg);
}

catch (MessagingException mex) {
// Prints all nested (chained) exceptions as well
mex.printStackTrace();
}

 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rangana Minesh wrote:
msg.setSubject("ONLINE SHOPPING DETAILS ");
msg.setContent("<h1> Online Shopping Details</h1>", "text/html");


Having an all-uppercase subject, using HTML, and repeating the words "online shopping" are all excellent ways to increase the likelihood of an email being classified as spam.
 
Vivek Alampally
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Rangana for your code. Sorry for being this late to respond. The problem was solved before itself. I did do minor modifications to my code. And now my e-mail goes direclty to inbox.

But can any body tell me, what all should I require to send e mail to person B from a Java program,
Answer I guess would be,

1. SMTP server name
2. User id & password of smtp server
3. Reciepient mail address


I am asking this question because I am still not sure what an SMTP server does. I know when I google about it there's a lot of theory involved with it. But can anybody tell
the process involved in it in three - four lines?
 
Paul Clapham
Marshal
Posts: 28425
102
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Three or four lines? Don't short-change yourself. If you're going to be sending e-mail then take some time to understand the process properly. One of the reasons that 90% of the messages sent by e-mail these days are spam is, there's way too many people who set up servers without understanding what they do.

Here's the Wikipedia article: Simple Mail Transfer Protocol.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Vivek Alampally,
Please can you tell me what changes you have done to fix the issue in your code.
Even my application mail is going to junk mail in some mail id's (mail is having image)
 
reply
    Bookmark Topic Watch Topic
  • New Topic