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
Related Tutorials/Questions & Answers:
how to send contact detail in emailhow 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 emailhow 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 sms on mobile and email using java codehow 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
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
java code to send an emailjava 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
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.
Send Email From JSP & ServletJ2EE Tutorial -
Send Email From JSP &
Servlet
...
how the required data
such as 'from', 'to', 'subject' and 'message
how to display the email message in jsphow 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
emailemail
how do i code for making clicking a
send button sends a
email 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
How to send mail - JSP-ServletHow 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 massage like way2sms.comHow 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 validate the email loginhow 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 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
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;ADS_TO_REPLACE_1
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 UINavigationBarHow 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 a mail - JSP-Servlethow to
send a mail Dear sir,
I am able to
send a mail.But when a receiver gets a mail ,the matter will be shown in a single line .
I am...
how to get a matter as it is what am sending..please help me sir if any changes
Send E-mail in HTML
Send E-mail in HTML
The Tutorial describes you a code that help you to
send Email... to
send email
from HTML page. In this page user can enter Name,
Email -id
How to send sms alerts to mobile using java?How to
send sms alerts to mobile using java? Hi i have used the Code to
send message on mobile using java code, it is not working -
COM2...(CommPortIdentifier.java:105)
confusion is there what is COM2 port and
how how to send spaces using get method.how to
send spaces using get method. hi
i want to know
how to
send spaces using get method?
for example like
http://localhost:8080/Sandeep?name=rose india
sorry for my english
Hello Friend,
Try the following