Discussion:
Mails send using javamail received as junk mails
MonaTakle
2009-02-12 04:25:10 UTC
Permalink
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= "***@sit-4p639gasn9b.abc.com";
String from= "***@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);
}
}
--
View this message in context: http://www.nabble.com/Mails-send-using-javamail-received-as-junk-mails-tp21969740p21969740.html
Sent from the Javamail mailing list archive at Nabble.com.

===========================================================================
To unsubscribe, send email to ***@java.sun.com and include in the body
of the message "signoff JAVAMAIL-INTEREST". For general help, send email to
***@java.sun.com and include in the body of the message "help".
Bill Shannon
2009-02-12 07:59:19 UTC
Permalink
Post by MonaTakle
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 ***@java.sun.com and include in the body
of the message "signoff JAVAMAIL-INTEREST". For general help, send email to
***@java.sun.com and include in the body of the message "help".
Loading...