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



Home Answers Viewqa JSP-Servlet Email sending in jsp

Have Programming Question? Ask it here!
 
 
 


Jaya Krishnan
Email sending in jsp
1 Answer(s)      5 years and 8 months ago
Posted in : JSP-Servlet



Advertisement
View Answers

December 4, 2008 at 1:25 AM


Hi friend,

Code to solve the problem :

"mailAPI.jsp"

<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">
<h1>Mail API</h1>
<tr>
<td width="50%"><b>To:</b></td>
<td width="50%"><input type="text" name="to" size="30"></td>
</tr>
<tr>
<td width="50%"><b>From:</b></td>
<td width="50%"><input type="text" name="from" size="30"></td>
</tr>
<tr>
<td width="50%"><b>Subject:</b></td>
<td width="50%"><input type="text" name="subject" size="30"></td>
</tr>
<tr>
<td width="50%"><b>Description:</b></td>
<td width="50%"><textarea name="description" type="text"
cols="40" rows="15" size=100>
</textarea>
</td>
</tr>
<tr>
<td><p><input type="submit" value="Send Mail" name="sendMail"></td>
</tr>
</table>
</p>
</form>
</td>
</tr>
</table>
</body>

</html>

"mail.jsp"

<%@ 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("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");
transport.sendMessage(m,m.getAllRecipients());
transport.close();
out.println("Thanks for sending mail!");
}
catch(Exception e){

out.println(e.getMessage());
e.printStackTrace();
}
%>


</body>

</html>

For more information on Java Mail Api visit to :

http://roseindia.net/javamail/

http://www.roseindia.net/mail/sending-an-email-in-jsp.shtml

Thanks


Related Tutorials/Questions & Answers:
Sending an email in JSP
Sending an email in JSP       Sending an email in JSP In this section, you will learn how to send an email in jsp.   Following is a simple JSP page for sending
Email sending in jsp - JSP-Servlet
Email sending in jsp  Hi, Im trying to send email from my jsp webserver.My webpage is running on Tomcat 5.0 server, and im using jsp coding.Now i've already tried a sample code from google, for sending email to my office 'smtp
Advertisements
sending email code - JSP-Servlet
sending email code  How To Send Emails using jsp  Hi friend, I am sending you a link. This link will help you. Please visit for more information. http://www.roseindia.net/mail/sending-an-email
Email sending
Email sending  Hi sir, Am doing a project, in that i need to send email to multiple recipients at a same time using jsp so send me the code as soon as possible. Regards, Santhosh
Sending email without authentication
Sending email without authentication  Hi sir, Am doing a project in JSP, in that i want to send mail without any authentication of password so send.../mail/sending-an-email-in-jsp.shtml
sending automatic email - JavaMail
sending automatic email  Dear sir. In my project i need to send an automatic email to the clients when their accounts are going to expire in 30 days.i am using jsp,mysql and tomcat for my project.Expire information are stored
Sending email with read and delivery requests
Sending email with read and delivery requests  Hi there, I am sending emails using JavaMail in Servlets on behalf of a customer from the website..., Gareth   Please visit the following link: JSP Servlet Send Mail
code for sending email using j2me
code for sending email using j2me  could someone tell me why when i try to compile this line using netbeans 7.1 Properties property... for sending a file attachment to gmail account
sending email using smtp in java
sending email using smtp in java  Hi all, I am trying to send and email to through my company mail server. Following is my code package com.tbss; import javax.mail.*; import javax.mail.internet.*; import
automatically resend when connection lost in sending email
automatically resend when connection lost in sending email  send automatically email when connection lost in sending bulk email using javamail for exp more than 10000 emails
automatically resend when connection lost in sending email
automatically resend when connection lost in sending email  send automatically email when connection lost in sending bulk email using javamail for exp more than 10000 emails
automatically resend when connection lost in sending email
automatically resend when connection lost in sending email  send automatically email when connection lost in sending bulk email using javamail for exp more than 10000 emails
JSP Email
JSP Email  Hi, How to send email using JSP? Thanks   Hi, Check this tutorial: Send Email to selected dropdown user Thanks
Email queue while sending mail using Struts Class
Email queue while sending mail using Struts Class  Can I maintain a queue of mails being sent from a JSP page in a DB to get its status
Email queue while sending mail using Struts Class
Email queue while sending mail using Struts Class  Can I maintain a queue of mails being sent from a JSP page in a DB to get its status
generate Email - JSP-Servlet
generate Email  Hi I need to generate an automated email and need to send it to the client like an confirmation email after registering to my website. I m using jsp code. Please help me out with this issue.  Hi friend
sending mail using jsp
sending mail using jsp  please give me the detailed procedure and code for sending mail through jsp program   Please visit the following links: http://www.roseindia.net/ejb/introduction/j2eedemo.shtml http
Sending File - JSP-Servlet
Sending File  How to use tag in Jsp, & How read a file fom... the following links: http://www.roseindia.net/jsp/fileupload.shtml http://www.roseindia.net/jsp/upload-insert-csv.shtml Hope that it will be helpful for you
sending a mail - JSP-Servlet
sending a mail   I m writing a code for send mail in jsp,i sending a mail to specified receiver but if i attach an file and send a mail then i m...... Attach : //In jsp... String strFileAttachment = request.getParameter
sending mails - JSP-Servlet
sending mails  my intension is sending mails through java program with out installing any softwares.what is code
sending mail - JSP-Servlet
sending mail  Hi, what is the code for sending mail automatically without user intervention? thanks in advance
sending mails - JSP-Servlet
sending mails   sending mail using smtp protocal ,while running,i got error an javax.mail.sendfailed exception. what is this error
jsp email - JSP-Servlet
jsp email  when the user forgets his password how to enable the user to retrieve his password using jsp code
Same email-massage is sending twice in online server(tomcat) but working fine in my local server(Tomcat)..
Same email-massage is sending twice in online server(tomcat) but working fine in my local server(Tomcat)..  Sir, I created one project in jsp for a software company. I am using listeners and timer for sending automatic
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
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 to multiple recipients using jsp
Email to multiple recipients using jsp  Hi sir, Am a doing a project,in that i need to send email to multiple user at a time,the to address should enter manually its not not be written in code using jsp. Regards, Santhosh
Email to multiple recipients using jsp
Email to multiple recipients using jsp  Hi sir, Am a doing a project,in that i need to send email to multiple user at a time,the to address should enter manually its not not be written in code using jsp. Regards, Santhosh
sending mail with attachment in jsp - JSP-Servlet
sending mail with attachment in jsp  Hi, Can any one pls tell me how to send email with attachment in jsp. I know how to send mail without attachment but with attachment its not working for me. If u hve any idea please
Sending query with variable - JSP-Servlet
Sending query with variable   While displaying pages in frames concept, one page contains links and other page contains messages for that links. The links page is not static one. Links page displays the contents from
Validate email id in jsp - JSP-Interview Questions
Validate email id in jsp  Hi Please Suggest me how to validate email id in JSP(Java Server Faces
PHP Email Tutorial, Sending email from PHP
Sending mail in PHP In this section we will learn how to send email from PHP program. You can send email from your PHP script using mail(...) function... call. Example 2. $email="admin@yourdomain.com, admin@otherdomain.com
sending mail with attachment in jsp - JSP-Servlet
sending mail with attachment in jsp  Hi Experts
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
Validate Domain of an Email Id - JSP-Servlet
Validate Domain of an Email Id  How to validate the domain name in an Email id before sending a mail for an application using Mail API. ex: a@a.com in the above email id i want to validate whether a.com is present
java code for sending sms - JSP-Servlet
java code for sending sms  hello sir, I want a code for sending sms on mobile . please send me if u have this Thanks & regards Dharmendra
email
email  how do i code for making clicking a send button sends a email
problem in sending more than 500 values to a jsp page
problem in sending more than 500 values to a jsp page  when i am trying to send more than 500 values from a html form to a jsp page browser is showing that server is not sending any data...I have configured tomcat5.5
Email validation is JSP using JavaScript
Email validation is JSP using JavaScript... will show you how to validate email address in you JSP program using JavaScript.... In your JSP program you can use JavaScript to validate the email address
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
Send Email From JSP & Servlet
J2EE Tutorial - Send Email From JSP & Servlet...; -------------------------------------------------------------------------------------------------------------------------- As for sending...' are collected  by the servlet and then processed for sending the mail
JSP check email exists or not
JSP check email exists or not In this tutorial, you will learn how to check from the database whether entered email-id exists or not. The given code accepts the email id from the user and check whether the given email id already
Sending Email with Attachment
Sending Email with Attachment       This Example shows you how to send a Attachment in the message using... the Transport.send() method. By this code you can get functionality to send Email
Java Email
Java Email  I am making one java email applications using jsp-servlets. can you tell me that how can i recieve and send email dynamically in my application in UI... thanx.   Hi, Please read at Email From JSP &
email archiving
email archiving  Hi, What is email archiving? Thanks
i have split a string by space ,done some operation and now how to properly order them for sending a mail in java or jsp - JSP-Servlet
order them for sending a mail in java or jsp  Dear sir, I have a text area in that i typed a some matter this is in one jsp .Then i got that matter in another jsp and stored in a string using getParameter(),then i splitted
Change Email
Change Email  Hi, I need to change my Rose India register email address for receive email, How did it possible
email validation
email validation  during email validation.... after domain name which it means if example example@gmail.co .... this address allowed by any validation program .... but i want to show invalid email address because domain name com
email validation
email validation  during email validation.... after domain name which it means if example example@gmail.co .... this address allowed by any validation program .... but i want to show invalid email address because domain name com
Sending emails and insert into trable
Sending emails and insert into trable  I have created a form, once people submit it should go to the email and insert to table also, the second part is working, but it's not getting to configured email. the code is below, I'm I
Advertisements
 

 

 

DMCA.com