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



Home Answers Viewqa JSP-Servlet Email sending
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


Santhosh Rajendran
Email sending
1 Answer(s)      2 years and 4 months ago
Posted in : JSP-Servlet


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.


Advertisement
View Answers

August 30, 2012 at 12:36 PM


Here is a jsp code that send mail to multiple recipients.

<%@ page import="java.io.*,java.util.*,javax.mail.*"%>
<%@ page import="javax.mail.internet.*,javax.activation.*"%>
<%@ page import="javax.servlet.http.*,javax.servlet.*" %>
<%
   String result;
   String to = "abcd@gmail.com";
   String from = "mcmohd@gmail.com";
   String host = "localhost";

   Properties properties = System.getProperties();
   properties.setProperty("mail.smtp.host", host);

   Session mailSession = Session.getDefaultInstance(properties);

   try{
      MimeMessage message = new MimeMessage(mailSession);
      message.setFrom(new InternetAddress(from));
      message.addRecipients(Message.RecipientType type, Address[] addresses);
      message.setSubject("This is the Subject Line!");
      message.setText("This is actual message");
      Transport.send(message);
      result = "Sent message successfully....";
   }catch (MessagingException mex) {
      mex.printStackTrace();
      result = "Error: unable to send message....";
   }
%>
<html>
<head>
<title>Send Email using JSP</title>
</head>
<body>
<center>
<h1>Send Email using JSP</h1>
</center>
<p align="center">
<% 
   out.println("Result: " + result + "\n");
%>
</p>
</body>
</html>

where addresses is the array of email ID. You would need to use InternetAddress() method while specifying email IDs

For more information, visit the following links:

http://www.roseindia.net/javamail/

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



Related Tutorials/Questions & Answers:
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
Advertisements
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 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
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
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, and I'm having difficulty understanding how to implement, read and delivery
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
Email sending in jsp - JSP-Servlet
Email sending in jsp  Hi, Im trying to send email from my jsp... i've already tried a sample code from google, for sending email to my office 'smtp... attached the whole coding as below: For input :index.jsp Sending
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
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
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
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
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
email
email  how do i code for making clicking a send button sends a email
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
email archiving
email archiving  Hi, What is email archiving? Thanks
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
JSP Email
JSP Email  Hi, How to send email using JSP? Thanks   Hi, Check this tutorial: Send Email to selected dropdown user Thanks
struts2 email code
struts2 email code  when I tried the code of sending email suggested by you on when I tried the code of sending email suggested by you on giving following exception. com.sun.mail.smtp.SMTPSendFailedException: 530 5.7.0 Must
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
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 entire page javascript
email entire page javascript  How to email entire page in JavaScript...['purpose']) && $_GET['purpose'] == "email") { $message = ob_get_contents(); ob_end_clean(); // your code for sending the $message } else
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..., For solving the problem visit to : http://www.roseindia.net/mail/sending
code for email - Spring
code for email  i want a java code using springs after login process sending an email to the corresponding with a text message to them as successfully registered  Hi Friend, Please visit the following links: http
email problem - JavaMail
email problem  hi,i want to write a code for sending a mail... should have the email id of only 1 employee only(means he will not able to know who other is the reciever of email.).i m trying to do this by writing mail code
Advertisements
 

 

 

DMCA.com