Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


rohit
java mail
0 Answer(s)      2 years and 7 months ago
Posted in : JavaMail


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>

Advertisement
View Answers

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  By Which code or function i can send E-mail to given E-mail Address   Hi Friend, Please visit the following link: Java Mail Thanks   Hi Friend, Please visit the following link: Java Mail
Advertisements
java mail
java mail  how to download javamail software give one examples   Please visit the following link: Java Mail API
java mail
want to understand the working of Java Mail download the source code from here and learn the coding logic behind Java Mail. You can even compile the source code...java mail  sir, I need a source code to understand
java mail
: Java Mail Thanks...java mail  import javax.mail.*; import javax.mail.internet....) throws MessagingException, AddressException { // Setup mail
java mail
java mail  Hi deepak, sorry to trouble again but with reference to apache mail server (james) tutorial i use the link that u have provided it redirects to apache offical site what there 4 zip and taz
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 - Java Beginners
java mail  how to send mail using with out Authentication?????????/ using gmail server
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
java mail - Java Beginners
java mail  how to send a mail without authentication one domain....  Hi, You have to use the Java mail api. You need to use the SMTP... is tutorials on Java Mail API: http://www.roseindia.net/javamail/index.shtml http
Java Mail - JavaMail
Java Mail  how to email using Java mail or automatic generated mail???  Hi Friend, Please visit the following link: http://www.roseindia.net/javamail/ Hope that it will be helpful for you. Thanks
java mail error - JavaMail
java mail error  how to rceive emails using java mail api  Hi Friend, We can use Java Mail APIs to send and receive mails in Java.... Please visit the following link to know more about use of Java Mail API. http
java mail api - JavaMail
java mail api  Hi, Pls give me the detailed information on how... points : 1.Download the Apache Mail server (James) http://james.apache.org... in the classpath. 3.Start the mail server. For read more information,Examples
java mail - JavaMail
java mail  how to send a mail without authentication in java ?  Hi Friend, Please visit the following link: http://www.roseindia.net/javamail/ Hope that it will be helpful for you. Thanks
mail
mail  how to send mail using jsp   Please visit the following links: JSP Send Mail Java Mail Tutorials
JAVA MAIL - JavaMail
JAVA MAIL  Hi! I am doing project called "E-mail Client". In this i want to view attachments which are in my mail in my application. I have tried... application using JAVA MAIL API.  Hi Friend, Please explain us what code
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 exception - JavaMail
Java Mail exception  Hi! I am developing E-mail Client (GMAIL) program using JSP technology. Till now i dont have any problem. From last 3 days while i am connecting to the Gmail, I am getting the following exception... Whats
Java Mail - JMS
Java Mail  Thanks for the previous jsp answer,that program is now running very well,creating no other problems. Now i am trying to learn java mail... is given below................. //My first java mail program............. import
JAVA Mail - JavaMail
JAVA Mail  Hi! I am trying to send the mail using SMTP of gmail. program was compiled successfully. when i am trying to execute that program it is showing error --- Must issue STARTTLS command first... How to avoid
JAVA MAIl - JavaMail
JAVA MAIl  Hi, I am trying to send a mail using java mail api. But I am getting following error: javax.mail.SendFailedException: Sending failed; nested exception is: javax.mail.MessagingException: Could not connect
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
what is java mail API - JavaMail
what is java mail API  Please tell me in detail what is 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> <
Introduction of Java Mail
Introduction of Java Mail       In this section we will describe Java Mail examples to be used... with attached files. Introduction to Java Mail API
Java Mail API - JavaMail
Java Mail API  Hi! I wish u advanced happy new year to all of ur... account using java mail api... i got code from our roseindia.net i.e....(PKIXValidator.java:280) ... 23 more Java Result: 1
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 - JavaMail
java mail  HI! I am developing email client. Using IMAP i am displaying all the messages which are in "INBOX". I want to know how to access remining folders such as "sent", "draft" and others..... Thanks in advance
Java Mail - JSP-Servlet
Java Mail  hi, i refer ur J2EE Tutorial - Send Email From JSP & Servlet to send emails from my application.but when i run the jsp it will throw thhese exceptions. ERROR.....javax.mail.SendFailedException: Sending failed
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 = "xxxxxx@gmail.com... in java file . but if i use set Content() method, mail content is display html
Advertisements
 

 

 

DMCA.com