Hi,
I want to send email, but i am not able to do so.
Below is my code.
What is wrong with this????
SMTP = smtp.quicknet.nl
Code::::::
<%@ page language="java" import="java.util.*, javax.mail.*, javax.mail.internet.*"%>
<%
// create the HTML email message to send
String htmlText = "";
htmlText += "<html><head>";
htmlText += "<style type=\"text/css\">";
htmlText += "body {font-family:verdana;font-size:10pt;margin:10px;}";
htmlText += "</style></head>";
htmlText += "<body>";
htmlText += "<p>This is a sample <b>HTML</b> email using the JavaMail APIs.</p>";
htmlText += "</body></html>";
String mailServer = "smtp.quicknet.nl"; // your mail server IP
String fromAddress = "samirkabuli@yahoo.com";
String toAddress = "fahimkabuli@hotmail.com";
String subjectText = "Internet generated email"; // the email subject
Properties props = new Properties();
props.put("mail.smtp.host", mailServer);
Session sesh = Session.getDefaultInstance(props,null);
MimeMessage message = new MimeMessage(sesh);
message.setContent(htmlText, "text/html");
InternetAddress from = new InternetAddress(fromAddress);
message.setFrom(from);
InternetAddress to = new InternetAddress(toAddress);
message.addRecipient(Message.RecipientType.TO, to);
message.setSubject(subjectText);
Transport.send(message);
out.println("gelukt of niet");
%>
I want to send email, but i am not able to do so.
Below is my code.
What is wrong with this????
SMTP = smtp.quicknet.nl
Code::::::
<%@ page language="java" import="java.util.*, javax.mail.*, javax.mail.internet.*"%>
<%
// create the HTML email message to send
String htmlText = "";
htmlText += "<html><head>";
htmlText += "<style type=\"text/css\">";
htmlText += "body {font-family:verdana;font-size:10pt;margin:10px;}";
htmlText += "</style></head>";
htmlText += "<body>";
htmlText += "<p>This is a sample <b>HTML</b> email using the JavaMail APIs.</p>";
htmlText += "</body></html>";
String mailServer = "smtp.quicknet.nl"; // your mail server IP
String fromAddress = "samirkabuli@yahoo.com";
String toAddress = "fahimkabuli@hotmail.com";
String subjectText = "Internet generated email"; // the email subject
Properties props = new Properties();
props.put("mail.smtp.host", mailServer);
Session sesh = Session.getDefaultInstance(props,null);
MimeMessage message = new MimeMessage(sesh);
message.setContent(htmlText, "text/html");
InternetAddress from = new InternetAddress(fromAddress);
message.setFrom(from);
InternetAddress to = new InternetAddress(toAddress);
message.addRecipient(Message.RecipientType.TO, to);
message.setSubject(subjectText);
Transport.send(message);
out.println("gelukt of niet");
%>