java mail

Ads
 

java mail

this code showing an error couldn't connect smtp host please help

<%@ page language="java" import="javax.naming.*,java.io.*,javax.mail.*,
javax.mail.internet.*,com.sun.mail.smtp.*"%>
<html>
<head>
<title>Mail</title>
</head>
<body>
<%
try{
  Session mailSession = Session.getInstance(System.getProperties());
  Transport transport = new SMTPTransport(mailSession,new URLName("smtp.gmail.com"));
  transport.connect("smtp.gmail.com",465,null,null);
  MimeMessage m = new MimeMessage(mailSession);
  m.setFrom(new InternetAddress(%><%request.getParameter("from")%><%));
  Address[] toAddr = new InternetAddress[] {
  new InternetAddress(%><%request.getParameter("to")%><%)
  };
  m.setRecipients(javax.mail.Message.RecipientType.TO, toAddr );
  m.setSubject(%><%request.getParameter("subject")%><%);
  m.setSentDate(new java.util.Date());
  m.setContent(%><%request.getParameter("description")%><%, "text/plain");

  transport.sendMessage(m,m.getAllRecipients());
  transport.close();
  out.println("Thanks for sending mail!");
}
catch(Exception e){
  out.println(e.getMessage());
  e.printStackTrace();
}
%>
</body>
</html>
View Answers

Ads









Related Tutorials/Questions & Answers:
java mail
java mail example  how to download javamail software give one examples   Please visit the following link: Java Mail API
java mail
java mail  how to download javamail software give one examples   Please visit the following link: Java Mail API
Advertisements
java mail
java mail  this code showing an error couldn't connect smtp host please help <%@ page language="java" import="javax.naming.*,java.io....(); out.println("Thanks for sending mail!"); } catch(Exception e
Java Mail API Tutorial
Java Mail API Tutorial  I have to write programs using the Java Mail API. I want to learn the Java Mail API. Let's know the urls to learn Java Mail... Mail API. The Java Mail API allows you to send, read emails from Java program
java mail programs
java mail programs  I got some codes from this about sending mail,forwarding mail,multipart mail etc..and I compiled and executed it,but it did... output.actually,do I need a mail server to get correct output of these codes?plz help me, I
send mail using smtp in java
send mail using smtp in java  How to send mail using smtp in java?   Sending mail in JSP - SMTP
java mail sending with images
java mail sending with images  I need to send images through java mail without giving content path(i.e. we don't want hard code the image path)can you tell me the idea?   Please visit the following links: http
java mail API
java mail API  <html> <head> <title>Mail API<...%" cellpadding="0" cellspacing="0"> <h1>Mail API</h1> <tr>...="submit" value="Send Mail" name="sendMail"></td> </tr> <
java mail send using setText()
java mail send using setText()  Hai , Am newly mail send portion in java , Here i write my code , final String userName = "[email protected] in java file . but if i use set Content() method, mail content is display html
mail
mail  how to send mail using jsp   Please visit the following links: JSP Send Mail Java Mail Tutorials
Introduction to Java Mail API
Introduction to Java Mail API       The Java Mail API allows the developers to add mailing... with the Java Mail API. The Java Mail API provides a platform-independent framework
Digitally signing email through Java mail api
Digitally signing email through Java mail api  how to sign (Digital Signature) one message using Java mail api
Sending images through java mail
Sending images through java mail  Am trying to develop greeting... and by clicking one image the control go to mail sending page in that the image should add to body part and the mail will sent to recipients..... please give me any idea
mail
mail  I wrote a program to send mail using smtp. But there is an error message " could not connect to smtp.gmail.com port 465. what is the problem how can i solve it ...   Please visit the following link: Java Mail API
Read Email using Java Mail API - James
Read Email using Java Mail API - James   https://www.roseindia.net/javamail/send-mail.shtml From this sample, i understand that we need to pass user... the emails from the James mail server irrespective of the users
Read Email using Java Mail API - James
Read Email using Java Mail API - James   https://www.roseindia.net/javamail/send-mail.shtml From this sample, i understand that we need to pass user... the emails from the James mail server irrespective of the users
Read Email using Java Mail API - James
Read Email using Java Mail API - James   https://www.roseindia.net/javamail/send-mail.shtml From this sample, i understand that we need to pass user... the emails from the James mail server irrespective of the users
Read Email using Java Mail API - James
Read Email using Java Mail API - James   https://www.roseindia.net/javamail/send-mail.shtml From this sample, i understand that we need to pass user... the emails from the James mail server irrespective of the users
Send multipart mail using java mail
Send multipart mail using java mail       This Example shows you how to send multipart mail using java mail. Multipart is like a container that holds one or more body
java source code to create mail server using struts2
java source code to create mail server using struts2  java source code to create mail server using struts2
Technical description of Java Mail API
Technical description of Java Mail API   ... Mail API. You must understand the Java Mail API before actually delving into the development of mail processing applications. Core classes that makeup the Java
How i can send testing mail on my id using java?
How i can send testing mail on my id using java?  Which packages i should use to implementing java mail service??? Thanks
how to get mail exchange records using java dns protocol
how to get mail exchange records using java dns protocol  Hi, how to get DNS mail exchage records(MX) using struts2 framework(server:glassfishv3) Thanks, B.Sucharitha.
How to set attachment from browse button to send mails using java mail api
How to set attachment from browse button to send mails using java mail api   Hello Sir, I am making Email Sending app using java mail api in jsp and servlet in that i have to make attachment option available using
problem in getting mail exchange records(MX) using DNS in java
problem in getting mail exchange records(MX) using DNS in java  Hi, jsp file: <%@page import="javax.naming.NamingEnumeration"%> <%@page import="javax.naming.Context"%> <%@page import="java.util.Hashtable
Handle EML(Electronic mail) file with Java Mail
Handle EML(Electronic mail) file with Java Mail       This Example shows you how to read any eml(Electronic mail) file using javamail api. eml is a simple email, all eml
Read attachment message using Java Mail
Read attachment message using Java Mail   ... a Attachment message using javamail api. Java Mail API provides classes to send multiple...;mail Return-Path: <[email protected]> Delivered-To: <
Introduction of Java Mail
Forwarding Messages using Java Mail
Forwarding Messages using Java Mail   ... using javamail api. there is no method to forward a mail from one user to another... and get message content then send its for another user. Java code given below
how to send mail with multiple attachments in jsp
how to send mail with multiple attachments in jsp  how to send mail with multiple attachments in java script
php mail
php mail  how to send the submitted form to mail after 24 hours? pls help me

Ads