how to send contact detail in email

Ads
 

how to send contact detail in email

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
View Answers

Ads









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 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 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
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
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 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
ModuleNotFoundError: No module named 'send_email'
'send_email' How to remove the ModuleNotFoundError: No module named 'send...ModuleNotFoundError: No module named 'send_email'  Hi, My Python... have to install padas library. You can install send_email python
ModuleNotFoundError: No module named 'django-send-email'
named 'django-send-email' How to remove the ModuleNotFoundError: No module named 'django-send-email' error? Thanks   Hi, In your...ModuleNotFoundError: No module named 'django-send-email'  Hi, My
ModuleNotFoundError: No module named 'odoo11-addon-runbot-send-email'
: No module named 'odoo11-addon-runbot-send-email' How to remove the ModuleNotFoundError: No module named 'odoo11-addon-runbot-send-email' error...ModuleNotFoundError: No module named 'odoo11-addon-runbot-send-email
ModuleNotFoundError: No module named 'pytest-send-email'
named 'pytest-send-email' How to remove the ModuleNotFoundError: No module named 'pytest-send-email' error? Thanks   Hi, In your...ModuleNotFoundError: No module named 'pytest-send-email'  Hi, My
ModuleNotFoundError: No module named 'send_html_email'
named 'send_html_email' How to remove the ModuleNotFoundError: No module named 'send_html_email' error? Thanks   Hi, In your python...ModuleNotFoundError: No module named 'send_html_email'  Hi, My
ModuleNotFoundError: No module named 'send_email_message'
named 'send_email_message' How to remove the ModuleNotFoundError: No module named 'send_email_message' error? Thanks   Hi, In your...ModuleNotFoundError: No module named 'send_email_message'  Hi, My
ModuleNotFoundError: No module named 'send_html_email'
named 'send_html_email' How to remove the ModuleNotFoundError: No module named 'send_html_email' error? Thanks   Hi, In your python...ModuleNotFoundError: No module named 'send_html_email'  Hi, My
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
how to send message
how to send message  how to send message for mobile in server
how to send sms on mobile
how to send sms on mobile  send sms on mobile by using struts + spring
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
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
To send pdf file to email in java
To send pdf file to email in java   Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: com/sun/mail/util/MailLogger at javax.mail.Session.initLogger(Session.java:283) at javax.mail.Session.
How to send HTTP request in java?
How to send HTTP request in java?  How to send HTTP request in java
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 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
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 send nsnotification to forward class
how send nsnotification to forward class   how to send nsnotification to a forward class? i am sending a nsnotification to a class which is not loaded yet. example,there is a class A,where i am creating a dictionary and posting
How to send UIWebView Title to UINavigationBar
How to send UIWebView Title to UINavigationBar  How can i replace the title of the UINavigationBar to UIWebView Page Title(i.e. javascript title)?   Write the given code into webViewDidFinishLoad method NSString
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

Ads