MonaTakle
2009-02-12 04:25:10 UTC
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);
}
}
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".
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".