April 09, 2009, 08:29 AM
Bill Cooperemail multiselect - sending data from maintain to dynamic list of recipients on save
I have a foc file with location, name, email.
I have a maintain that captures approval information for collaboration.
When I save updates to data using the maintain, I would like to send an email to a dynamic list of recipients based on location with some of the information that was updated.
The location has already been determined with an established global variable.
I am looking for an email procedure or something I can use to send the emails with.
I need to be able to pass the dynamic list of who I am sending TO:
I need to pass a predetermined RE: (or it can be coded in the email app)
I need to pass some of the fields of data captured with the maintain as MESSAGE:
Then I need some way of verifying that the emails have been sent.
Has anyone developed something like this or know of someone who has?
Bill Cooper
Nationwide
cooperw@nationwide.com
WebFocus 7.6.5
April 09, 2009, 09:53 AM
Maintain WizardWe have a sample JSP file that works at some sites. You can pass the pieces of the e-mail (From, To, Subject and Body) from a Winform using JavaScript to the JSP. It automatically and silently sends the mail. I do not have a way to get a confirmation though.
Here is JS and jsp file. Make sure to change the SMTP client and webpage location to reflect your site. Please note that the EditBox values, 1 - 4 are collected from a Winform. In order for Mainain to pass values to a JavaScript they must be placed on a form. The values in the those editboxes can either be singular or a list.
Mark
function OnButton1_Click() {
webpage = "http://md00715:8080/approot/Email/test.jsp";
getTo = document.getElementById("EditBox1").value;
getFrom = document.getElementById("EditBox2").value;
getSubject = document.getElementById("EditBox3").value;
getInqNum = document.getElementById("EditBox4").value;
url = webpage + "?getTo=" + getTo + "&getFrom=" + getFrom + "&getSubj=" + getSubject + "&getInqNum=" + getInqNum;
window.open(url,"emailwin");
}
<html>
<BODY>
<%@ page import="sun.net.smtp.SmtpClient, java.io.*" %>
<%
String from=request.getParameter("getFrom");
String to=request.getParameter("getTo");
String subj=request.getParameter("getSubj");
String body=request.getParameter("getBody");
try{
SmtpClient client = new SmtpClient("IBIUSMBSA.ibi.com");
client.from(from);
client.to(to);
PrintStream message = client.startMessage();
message.println("To: " + to);
message.println("From: " + from);
message.println("Subject: " + subj);
message.println(body);
client.closeServer();
}
catch (IOException e){
System.out.println("ERROR SENDING EMAIL:"+e);
}
%>
<script language="JavaScript">
{
window.close();
}
</script>
</BODY
</html>