home | career | drupal | java | mac | mysql | perl | scala | uml | unix  
<td width="100%" nowrap> <a class="nav" href="<%=indexUrl%>"> »  <a class="nav" href="index">Admin CP »  Send Email </td> </tr> </table> <br/> <table class="tborder" width="95%" cellspacing="1" cellpadding="3" align="center"> <tr class="pagedesc"> <td> This page let you send email to specific email addresses or different groups of users. When send to a group of members, you can use these member values for your email template: ${memberID} (the numberic id, eg: 1) , ${memberName} (the login id. eg: Admin) , ${memberFirstname} , ${memberLastname} , ${memberEmail}. You could use the Preview button below to preview the sample email applying template before you send the email. <p> Note: to separate emails in the input box below, please use semi-colon character (';') <p> Please see template help at <a href="http://www.freemarker.org">FreeMarker </td> </tr> </table> <br/> <% if (preview) { String previewTo = ParamUtil.getAttribute(request, "PreviewTo"); String previewCc = ParamUtil.getAttribute(request, "PreviewCc"); String previewBcc = ParamUtil.getAttribute(request, "PreviewBcc"); String previewSubject = ParamUtil.getAttribute(request, "PreviewSubject"); String previewMessage = ParamUtil.getAttribute(request, "PreviewMessage"); String previewEmail = ParamUtil.getAttribute(request, "PreviewEmail"); String warningMessage = ParamUtil.getAttribute(request, "WarningMessage"); %> <table class="tborder" width="95%" cellspacing="1" cellpadding="3" align="center"> <tr class="theader"> <%if (previewEmail.indexOf("@") > -1 ) {%> <td colspan="2">This is a sample email sending to <%=previewEmail%> <%} else {%> <td colspan="2">Preview Email (no template applying) <%}%> </tr> <tr class="trow1"> <td align="right" nowrap>* From: <td class="messageText"><%=from%> </tr> <tr class="trow2" id="To"> <td align="right" nowrap>* To: <td class="messageText"> <%=previewTo%> <%if (mailToSelector > 0) { %> <span class="warning">( <%=warningMessage%> ) <% } %> </td> </tr> <tr class="trow1"> <td align="right">Cc: <td class="messageText"><%=previewCc%> </tr> <tr class="trow2"> <td align="right">Bcc: <td class="messageText"><%=previewBcc%> </tr> <tr class="trow1"> <td align="right" nowrap>* Subject: <td class="messageText"><%=previewSubject%> </tr> <tr class="trow2"> <td align="right" valign="top" nowrap>* Message: <td class="messageText"><%=previewMessage%> </tr> </table> <br/> <%}//if preview%> <form action="sendmailprocess" method="post" name="submitform"> <input type="hidden" name="preview" value=""> <table class="tborder" width="95%" cellspacing="1" cellpadding="3" align="center"> <tr class="theader"> <td colspan="2">Send e-mail: </tr> <tr class="trow1"> <td align="right" nowrap>* From: <td> <input type="text" name="From" value="<%=from%>" size="60"> <input type="button" value="Insert <%=MVNForumConfig.getWebMasterEmail()%>" class="liteoption" onClick="javascript:InsertDefaultEmail();"> </td> </tr> <tr class="trow2" id="To"> <td align="right" valign="top" nowrap>* To: <td> <input type="radio" name="MailToSelector" value="1" id="MailToSelector@1" class="noborder"> All members in group <select name="group"> <% Collection groupBeans = (Collection)request.getAttribute("GroupBeans"); for (Iterator groupIter = groupBeans.iterator(); groupIter.hasNext(); ) { GroupsBean groupBean = (GroupsBean)groupIter.next(); int groupID = groupBean.getGroupID(); String groupName = groupBean.getGroupName(); %> <option id="group@<%=groupID%>"value="<%=groupID%>"><%=groupName%> <%}%> </select> <br/> <input type="radio" name="MailToSelector" value="2" id="MailToSelector@2" class="noborder"> All activated members
<input type="radio" name="MailToSelector" value="3" id="MailToSelector@3" class="noborder"> All non-activated members
<input type="radio" name="MailToSelector" value="0" id="MailToSelector@0" checked class="noborder"> Specific email addresses below
<input type="text" name="To" value="<%=to%>" size="60"> </td> </tr> <tr class="trow1"> <td align="right" nowrap>Cc: <td> </tr> <tr class="trow2"> <td align="right" nowrap>Bcc: <td> </tr> <tr class="trow1"> <td align="right" nowrap>* Subject: <td> </tr> <tr class="trow2"> <td align="right" valign="top" nowrap>* Message: <td> </tr> <tr class="trowfinal"> <td colspan="2" align="center"> <input type="button" name="previewbutton" value="Preview" onclick="javascript:SubmitPreviewForm();" class="liteoption"> <input type="button" name="submitbutton" value="Send mail" onclick="javascript:SubmitForm();" class="mainoption"> <input type="reset" value="Reset" class="liteoption"> </td> </tr> </table> </form> <br/> </fmt:bundle> <%@ include file="footer.jsp"%> <script language="JavaScript" type="text/javascript"> <!-- InitParam(); //--> </script> </body> </html>

What this is

This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Other links

The source code

<%--
 - $Header: /cvsroot/mvnforum/mvnforum/srcweb/mvnplugin/mvnforum/admin/sendmail.jsp,v 1.41 2005/01/18 11:01:37 minhnn Exp $
 - $Author: minhnn $
 - $Revision: 1.41 $
 - $Date: 2005/01/18 11:01:37 $
 -
 - ====================================================================
 -
 - Copyright (C) 2002-2005 by MyVietnam.net
 -
 - This program is free software; you can redistribute it and/or
 - modify it under the terms of the GNU General Public License
 - as published by the Free Software Foundation; either version 2
 - of the License, or any later version.
 -
 - All copyright notices regarding mvnForum MUST remain intact
 - in the scripts and in the outputted HTML.
 - The "powered by" text/logo with a link back to
 - http://www.mvnForum.com and http://www.MyVietnam.net in the
 - footer of the pages MUST remain visible when the pages
 - are viewed on the internet or intranet.
 -
 - This program is distributed in the hope that it will be useful,
 - but WITHOUT ANY WARRANTY; without even the implied warranty of
 - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 - GNU General Public License for more details.
 -
 - You should have received a copy of the GNU General Public License
 - along with this program; if not, write to the Free Software
 - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 -
 - Support can be obtained from support forums at:
 - http://www.mvnForum.com/mvnforum/index
 -
 - Correspondence and Marketing Questions can be sent to:
 - info@MyVietnam.net
 -
 - @author: Minh Nguyen  minhnn@MyVietnam.net
 - @author: Mai  Nguyen  mai.nh@MyVietnam.net
 --%>
<%@ page contentType="text/html;charset=utf-8" %>
<%@ page errorPage="fatalerror.jsp"%>
<%@ page import="com.mvnforum.MVNForumConfig" %>
<%@ page import="java.util.*" %>
<%@ page import="com.mvnforum.db.*" %>
<%@ page import="net.myvietnam.mvncore.filter.*" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<%@ include file="inc_common.jsp"%>
<fmt:bundle basename="mvnForum_i18n">
<html>
<head>
  <title> - Send Email
<%@ include file="/mvnplugin/mvnforum/meta.jsp"%>
<link href="<%=onlineUser.getCssPath()%>" rel="stylesheet" type="text/css">
</head>
<body leftmargin="0" topmargin="0">
<%@ include file="inc_js_checkvalid_myvietnamlib.jsp"%>
<% 
String from = "";
String to = "";
String cc = "";
String bcc = "";
int mailToSelector = -1;
String group = "";
String subject = "";
String message = "";
boolean preview = ParamUtil.getParameterBoolean(request, "preview");
if (preview) {
    from = ParamUtil.getParameterEmail(request, "From");
    to = ParamUtil.getParameter(request, "To");
    cc = ParamUtil.getParameter(request, "Cc");
    bcc = ParamUtil.getParameter(request, "Bcc");
    mailToSelector = ParamUtil.getParameterInt(request, "MailToSelector");

    group = ParamUtil.getParameter(request, "group");
    subject = ParamUtil.getParameter(request, "Subject");
    message = ParamUtil.getParameter(request, "Message");
}
%>
<script type="text/javascript">
function SubmitForm() {
  if (ValidateForm() == true ) {
    document.submitform.submitbutton.disabled=true;
    document.submitform.submit();
  }
}
function SubmitPreviewForm() {
  if (ValidateForm() == true ) {
    document.submitform.preview.value='true';
    document.submitform.action = 'sendmail';
    document.submitform.previewbutton.disabled=true;
    document.submitform.submit();
  }
}
function ValidateForm() {
  if (isBlank(document.submitform.From, "From")) return false;
  if (!isEmail(document.submitform.From, "From")) return false;
  if (document.getElementById("MailToSelector@0").checked == true) {
    if (isBlank(document.submitform.To, "To")) return false;
    // Note that we dont check email for To because To can be a string of many emails
  }
  
  if (isBlank(document.submitform.Subject, "Subject")) return false;
  if (isBlank(document.submitform.Message, "Message")) return false;
  return true;
}
function InsertDefaultEmail() {
  document.submitform.From.value='<%=MVNForumConfig.getWebMasterEmail()%>';
}
function InitParam() {
<% if (preview) {%>
  <% if ( mailToSelector >= 0 ) {%> 
      var id = document.getElementById("MailToSelector@<%=mailToSelector%>");
      if (id != null) id.checked = true;
  <% } %>
  <% if ( group.length() > 0 ) {%> 
      var id = document.getElementById("group@<%=group%>");
      if (id != null) id.selected = true;
 <%  }
   } %>
}
</script>

<%@ include file="header.jsp"%>
<br/>

<table width="95%" align="center">
  <tr class="nav">
    <td>


my book on functional programming

 

new blog posts

 

Copyright 1998-2019 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.