java mail

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
mail
mail  how to send mail using jsp   Please visit the following links: JSP Send Mail Java Mail Tutorials
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
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
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
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
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
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
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
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
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.
Maven dependency for com.aerse - mail version 1.0 is released. Learn to use mail version 1.0 in Maven based Java projects
Maven dependency for  com.aerse  - Version 1.0 of mail released The developers of   com.aerse - mail project have released the latest... - mail library is 1.0. Developer can use this version ( com.aerse - mail version
Maven dependency for com.aerse - mail version 1.1 is released. Learn to use mail version 1.1 in Maven based Java projects
Maven dependency for  com.aerse  - Version 1.1 of mail released The developers of   com.aerse - mail project have released the latest... - mail library is 1.1. Developer can use this version ( com.aerse - mail version
Maven dependency for com.aerse - mail version 1.2 is released. Learn to use mail version 1.2 in Maven based Java projects
Maven dependency for  com.aerse  - Version 1.2 of mail released The developers of   com.aerse - mail project have released the latest... - mail library is 1.2. Developer can use this version ( com.aerse - mail version
Maven dependency for com.aerse - mail version 1.3 is released. Learn to use mail version 1.3 in Maven based Java projects
Maven dependency for  com.aerse  - Version 1.3 of mail released The developers of   com.aerse - mail project have released the latest... - mail library is 1.3. Developer can use this version ( com.aerse - mail version
Maven dependency for com.globalmentor - globalmentor-mail version 0.6.0 is released. Learn to use globalmentor-mail version 0.6.0 in Maven based Java projects
to use  com.globalmentor - globalmentor-mail version 0.6.0 in Java projects... and includes  com.globalmentor - globalmentor-mail version 0.6.0 java library... of globalmentor-mail released The developers of   com.globalmentor - globalmentor
Maven dependency for cocoon - cocoon-mail version 2.1.3 is released. Learn to use cocoon-mail version 2.1.3 in Maven based Java projects
- cocoon-mail version 2.1.3 ) in their Java project if it is based on Maven... to use  cocoon - cocoon-mail version 2.1.3 in Java projects. Follow the step... and includes  cocoon - cocoon-mail version 2.1.3 java library in your
Maven dependency for cocoon - cocoon-mail version 2.1.5.1 is released. Learn to use cocoon-mail version 2.1.5.1 in Maven based Java projects
( cocoon - cocoon-mail version 2.1.5.1 ) in their Java project if it is based...? Steps to use  cocoon - cocoon-mail version 2.1.5.1 in Java projects... that downloads and includes  cocoon - cocoon-mail version 2.1.5.1 java
Maven dependency for cocoon - cocoon-mail version 2.1.7 is released. Learn to use cocoon-mail version 2.1.7 in Maven based Java projects
- cocoon-mail version 2.1.7 ) in their Java project if it is based on Maven... to use  cocoon - cocoon-mail version 2.1.7 in Java projects. Follow the step... and includes  cocoon - cocoon-mail version 2.1.7 java library in your

Ads