How to send an email to hotmail, yahoo or other accounts using SMTP.
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Sirisha_Ramireddy
Posted On:   Monday, September 22, 2003 10:55 AM

Hi All, I am trying to send an email using the following code in our web app. ------> package dnrtest.application.web.pdfservlet; import java.util.Properties; import javax.mail.*; import javax.mail.internet.*; public class SendEmail { private static final java.lang.String SMTP_HOST = "mail.dnr.state.ga.us"; public SendEmail() { super(); } /*public static void main(String args[]) throws Exception { String from = "sirisha_ramireddy@mail.dnr.state.ga.us"; String to = "sirishavuluvala@yahoo.com"; String subject = "ATR Certifcate"; String text = &qu   More>>

Hi All,

I am trying to send an email using the following code in our web app.

------>
package dnrtest.application.web.pdfservlet;

import java.util.Properties;
import javax.mail.*;
import javax.mail.internet.*;

public class SendEmail
{
private static final java.lang.String SMTP_HOST = "mail.dnr.state.ga.us";

public SendEmail()
{
super();
}
/*public static void main(String args[]) throws Exception
{

String from = "sirisha_ramireddy@mail.dnr.state.ga.us";
String to = "sirishavuluvala@yahoo.com";
String subject = "ATR Certifcate";
String text = "Your ATR Certificate has been generated, please print a copy and save it for your records";

sendEmailTo(from, to, subject, text);

} */

public static void sendEmailTo(String from, String to, String subject, String text)
{
try
{
// Get system properties
Properties props = System.getProperties();

// Setup mail server
props.put("mail.smtp.host", SMTP_HOST);

// Get session
Session session = Session.getInstance(props, null);

// Define message
MimeMessage message = new MimeMessage(session);
message.setFrom(new InternetAddress(from));
message.addRecipient(Message.RecipientType.TO, new InternetAddress(to));
message.setSubject(subject);
message.setText(text);

// Send message
Transport.send(message);
}
catch (Exception e)
{
System.out.println(e);
}
}
}


But my problem is I was able to send mail to anybody within our Groupwise server ( host is mail.dnr.state.ga.us ). But when I tried to send an email to either Hotmail or Yahoo the mail is bouncing back. I haven't tried any other accounts. Please help.

Thank you,
Sirisha.

   <<Less
About | Sitemap | Contact