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



Home Answers Viewqa JavaMail how to send contact detail in email
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


surendra
how to send contact detail in email
0 Answer(s)      2 years and 7 months ago
Posted in : JavaMail


hi...all of u.....i am work in jsp..i m new developer...i have create a my company website... than i have one problem...frnd how to send a contact form detail mail on a click submit button in jsp...pls help me.... this is my html page....

<html>
<head>
<title>Mail API</title>
</head>
<body>
<table border="1" width="50%"  cellpadding="0" cellspacing="0">
  <tr>
  <td width="100%">
  <form method="POST" action="mail.jsp">
  <table border="1" width="100%" cellpadding="0" cellspacing="0">

  <tr>
  <td width="50%"><b>To:</b></td>
  <td width="100%"><input type="text" name="to" size="50"></td>
  </tr>
  <tr>
  <td width="50%"><b>Form:</b></td>
  <td width="100%"><input type="text" name="from" size="50"></td>
  </tr>
  <tr>
  <td width="50%"><b>Subject:</b></td>
  <td width="100%"><input type="text" name="subject" size="50"></td>
  </tr>

<tr>
  <td width="50%"><b>Name:</b></td>
  <td width="100%"><input type="text" name="name" size="50"></td>
  </tr>


<tr>
  <td width="50%"><b>Email:</b></td>
  <td width="100%"><input type="text" name="email" size="50"></td>
  </tr>

<tr>
  <td width="50%"><b>Phone:</b></td>
  <td width="100%"><input type="text" name="phone" size="50"></td>
  </tr>

  <tr>
  <td width="50%"><b>Description:</b></td>
  <td width="100%"><textarea name="description" type="text" 
    cols="40" rows="5" size=80>
  </textarea>
  </td>
  </tr>
  <tr>
  <td><p><input type="submit" value="Send Mail" name="sendMail"></td>
  </tr>
  </table>
  </p>
  </form>
  </td>
  </tr>
</table>
</body>
</html>


and this is my jsp page....

<%@ page language="java" import="javax.naming.*,java.io.*,javax.mail.*,
javax.mail.internet.*,com.sun.mail.smtp.*"%>Ok
<html>
<head>
<title>Mail</title>
</head>
<body>
<%
try{
  Session mailSession = Session.getInstance(System.getProperties());
  Transport transport = new SMTPTransport(mailSession,new URLName("localhost"));
  transport.connect("localhost",25,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");
  m.setContent(%><%request.getParameter("name")%><%, "text/plain");
  m.setContent(%><%request.getParameter("email")%><%, "text/plain");
  m.setContent(%><%request.getParameter("phone")%><%, "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

> Blockquote

Advertisement
View Answers

Related Tutorials/Questions & Answers:
how to send contact detail in email
how to send contact detail in email  hi...all of u.....i am work... problem...frnd how to send a contact form detail mail on a click submit button...%"><b>Email:</b></td> <td width="100%"><input
how to send email
how to send email  hii i am new for jsp-servlet and i am making a project in jsp-servlet. i want to send the email after registration to client.please send me code that how to send mail after client registration. thank you
Advertisements
how to send html email from dreamweaver
how to send html email from dreamweaver  how to send html email from dreamweaver
how to send email in php and attech with any file
how to send email in php and attech with any file  how to send email and attech with any file like text, image, video
How to send and recieve email by using java mailserver
How to send and recieve email by using java mailserver  How to send and receive email by using java mail server?   Hi Friend, Please visit the following link: Java Mail Thanks
how to send email list of email address through in database table list
how to send email list of email address through in database table list  package com.com; import java.io.IOException; import java.io.PrintWriter; import java.sql.PreparedStatement; import java.sql.ResultSet; import
send email with attachments in servlet
send email with attachments in servlet  How can we send an email with attachments in servlet?   Send attached email in Java Servlet
how to send email please give me details with code in jsp,servlet
how to send email please give me details with code in jsp,servlet  how to send email please give me details with code in jsp,servlet
how to send sms on mobile and email using java code
how to send sms on mobile and email using java code  hi.... I am developing a project where I need to send a confirmation/updation msg on clients mobile and also an email on their particular email id....plz help me to find
How to send Email automatically On Daily Basis Using Systems Date.
How to send Email automatically On Daily Basis Using Systems Date.  Hello Sir, I am working on a project in which i have to send emails automatically based on system dates with attchements .Kindly give me the code
send HTML Email with jsp and servlet
send HTML Email with jsp and servlet  Can You please show me how to send html Email using JSP and Servlet thank you
java code to send an email
java code to send an email  i developed one java code that has to send a mail but i am getting an runtime exception calledjavax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 465; nested
Send Email From JSP & Servlet
J2EE Tutorial - Send Email From JSP & Servlet      ... webserver, using JavaMail API, the following code shows how the required
Send email as html with embedded images as background
Send email as html with embedded images as background  Hi, I am developing a PHP mailing application. I have to send image in the email as attachment. Give me solution for sending image in the email data. Thanks
java code to send email using gmail smtp server
java code to send email using gmail smtp server  please send me the java code to send email using gmail smtp server. and how to send verification code
how to validate the email login
how to validate the email login  // JavaScript Document JOIN US... Name Email Contact No Address City new.jsp <%@page import="java.sql....; var lname=document.form.lname.value; var email=document.form.email.value; var
how to display the email message in jsp
how to display the email message in jsp  hi every one .. i am new from this industry please help me to display the email message in jsp page please send me sample code
email
email  how do i code for making clicking a send button sends a email
This code send email two times but i want only once
This code send email two times but i want only once   public void dbbackup_notify(String email,String data,String subject){ String toEmails = email; Session session=Session.getInstance(props, new
This code send email two times but i want only once
This code send email two times but i want only once   public void dbbackup_notify(String email,String data,String subject){ String toEmails = email; Session session=Session.getInstance(props, new
how to send message
how to send message  how to send message for mobile in server
email
email   hi I am using 1and1 server. Using this server i am sending a mail using java program . But it is running some problem occur " Cannot send email. javax.mail.SendFailedException: Invalid Addresses; nested exception
how to send sms on mobile
how to send sms on mobile  send sms on mobile by using struts + spring
How does Email works
How does Email works      ... server contact to the Recipient’s Email server provided in the Email... send email to the address’s email server. When recipient log on his mail
Contact Us
Rose India D-16/116 Sector-3, Rohini Delhi-110085 India Phone: +91-9313063554 Email: deepak@roseindia.net
How to send HTTP request in java?
How to send HTTP request in java?  How to send HTTP request in java
contact and activity management system
contact and activity management system  how to make a web application on contact and activity management system. can anyone help me
How i can send mail by using jsp.............. - JavaMail
How i can send mail by using JSP  Hi, will you please tell me how i can send mail by using jsp. Tell me in detail. Thanks!  Example and JSP... to create a send mail program using JSP.JSP Send Mail Program Resources:-http
How to send massage like way2sms.com
How to send massage like sms websites  Hi sir how i can make a small project in php (send massage by website like free sms website on internet) Please advice me
How to send mail - JSP-Servlet
How to send mail  Thanks a lot ODBC is cleared to me now. Now,have another query about how we can send mail by using jsp. Actually i want to make a web page for a user feedback ,it must be send to our mail id
How to send the request and get the request?
How to send the request and get the request?  how to send a request to a JSP file in another domain in the same server and get the request done i.e how to include JSP file of one domain to another doamin JSP within in the same
 

 

 

DMCA.com