Mails send using javamail received as junk mails

View: New views
2 Messages — Rating Filter:   Alert me  

Mails send using javamail received as junk mails

by MonaTakle :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Messages send using javamail are received as junk mails in outlook express. What settings need to be done to avoid this. The source code for sending the mails is as below:

import javax.mail.*;
import javax.mail.internet.*;
import java.util.*;
import java.util.Properties;
import javax.mail.internet.*;
/**
  * A simple email sender class.
  */
class SimpleSender
{
  /**
    * Main method to send a message given on the command line.
    */
  public static void main(String args[])
  {
    try
    {
      String smtpServer=  "192.168.0.111";
      String to= "mona@sit-4p639gasn9b.abc.com";
      String from= "darshit@sit-4p639gasn9b.abc.com";
      String subject= "Msg using Javamail";
      String body= "THis is a msg uaing Java mail....";
      Properties prop  = System.getProperties();
      prop.put("mail.smtp.host", smtpServer);
      Session ses1 = Session.getDefaultInstance(prop, null);
      MimeMessage msg = new MimeMessage(ses1);
      msg.setFrom(new InternetAddress(from));
      msg.addRecipient(Message.RecipientType.TO , new InternetAddress(to));
      msg.setSubject(subject);
      msg.setText(body);
      Transport.send(msg);
      System.out.println("\nMessage Sent ...");
    }
    catch (Exception ex)
    {
    System.out.println(ex.toString());
    System.out.println("Usage: java com.lotontech.ma il.SimpleSender"+" smtpServer toAddress fromAddress subjectText bodyText");
    }
    System.exit(0);
  }
}

Re: Mails send using javamail received as junk mails

by Bill Shannon :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

MonaTakle wrote:
> Messages send using javamail are received as junk mails in outlook express.

If the message is received by Thunderbird is it *not* marked as junk mail?
Are you sure it's Outlook Express that's marking it as junk mail and not
the mail server?

If you send the same message with Thunderbird, is it also marked as junk mail?
If not, compare the raw MIME text of the two messages to see what the
difference is.

Also, try authenticating to your mail server and see if that makes any
difference.

===========================================================================
To unsubscribe, send email to listserv@... and include in the body
of the message "signoff JAVAMAIL-INTEREST".  For general help, send email to
listserv@... and include in the body of the message "help".