Solved

sending multiple mail recepiants via form to a JSP

Posted on 2004-03-28
5
250 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
  • 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
eclipse problems view not showing all the time 4 88
immutable object concept 5 120
how to add new optional parameter to JSP 1 43
web application structure 18 77
Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
The question appears often enough, how do I transfer my data from my old server to the new server while preserving file shares, share permissions, and NTFS permisions.  Here are my tips for handling such a transfer.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

825 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