Solved

sending multiple mail recepiants via form to a JSP

Posted on 2004-03-28
5
254 Views
Last Modified: 2010-04-01
I found that if I were to use a simple thing as mailto to a list of user in a String format. i.e.

<% String finalEmailList = "user1@company.com,user2@company.com"; %>
<a href="mailto:<%=finalEmailList%>">Email candidate</a>

Groupwise does not really like it and only sent email to the first user. Any clue on how to solve this?

I have since created a form post thing...but still stuck. I am not sure if I need to introduce Array. If I need to, how could I get the email into array and then pass it via form post?

Any help is much appreciated. Thank you.


[CODE]
<%
String finalEmailList = "user1@company.com,user2@company.com";
%>

<FORM name=myform METHOD="post" ACTION="sendMail.jsp">

<INPUT class=inputText TYPE="text" NAME="f_mail_subject" MAXLENGTH="200" SIZE="40" VALUE="">

<TEXTAREA NAME="f_mail_body" COLS=40 ROWS=8 VALUE=""></TEXTAREA>

<input type="hidden" name="f_mail_to" value="<%=finalEmailList%>" >
<input class="buttons" type="submit" value="submit" name="action">
<input class="buttons" type="Reset">

</form>

---- This is my sendMail.jsp ---

<%@ page import="com.mail.SendMail"%>
<%@ page import="com.mail.AppConfig"%>
<% AppConfig appConfig = new AppConfig(); %>

SendMail thisSendMail = new SendMail();
               
thisSendMail.setUser(appConfig.getMailUser());
thisSendMail.setPwd(appConfig.getMailPwd());      
thisSendMail.setServer(appConfig.getSmtpServer());
thisSendMail.setFrom(appConfig.getSystemAccount());
thisSendMail.setTo(request.getParameter("f_mail_to"));
thisSendMail.setContentType("text/html");
thisSendMail.setSubject(request.getParameter("f_mail_subject"));
thisSendMail.setMessage(request.getParameter("f_mail_body"));
               
if ( thisSendMail.Send() )
{
   out.println(" Mail sent successful.");
} else {
   out.println("unsuccessful");
}
[/CODE]
0
Comment
Question by:Tuan_Jean
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 7

Accepted Solution

by:
searlas earned 20 total points
ID: 10702636
1) See the mailto: url spec (you may want to use cc and bcc lines to handle multiple addresses)
http://www.faqs.org/rfcs/rfc2368.html

2) You cannot use a form to post to or launch your mail reader (Groupwise.)
0
 
LVL 7

Expert Comment

by:searlas
ID: 10702665
Correction, to (2) above...

Yes, you can... but you/I get a warning when doing it:
Use ; instead of , to separate mail addresses...

<html>
    <head>
        <title>email test</title>
    </head>
    <body>
        <form action="mailto:sampe@spam.com;sample2@spam.com" method="get">
            <input type="text" name="subject">
            <input type="submit" value="go">
        </form>
    </body>
</html>
0
 

Author Comment

by:Tuan_Jean
ID: 10720181
I found that I could use message.addRecepiant
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Gain an elementary understanding of Blockchain technology.
Sometimes clients can lose connectivity with the Lotus Notes Domino Server, but there's not always an obvious answer as to why it happens.   Read this article to follow one of the first experiences I had with Lotus Notes on a client's machine, my…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question