在线等待,如何在JSP中用Lotus Domino Toolkit提供的DCOMail发信?
我看了Domino Toolkit中提供的JSP例子,代码如下:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<%@ page import="lotus.dco.beans.*,java.util.*" errorPage="Oops.jsp" %>
<html>
<head>
<title>Sending Mail with DCO</title>
</head>
<SCRIPT LANGUAGE="JavaScript">
<!--
// Returns true if a string contains only whitespace characters.
function isBlank(s)
{
for (var i = 0; i < s.length; i++) {
var c = s.charAt(i);
if ((c != ' ') && (c != '\n') && (c != '\t')) return false;
}
return true;
}
// Verify required fields are filled in
function verify(f)
{
var errors = "";
if ( (isBlank(f.sendTo.value)) &&
(isBlank(f.copyTo.value)) &&
(isBlank(f.blindCopyTo.value)) ) {
errors = "You must fill in either the To:, cc:, or bcc: field\n";
}
if (isBlank(f.server.value))
errors += "You must specify your Mail Server\n";
if (errors == "") return true;
errors += "\nYour form was not submitted because of the above problem(s)\n";
errors += "Please fill in the required fields and re-submit\n";
alert(errors);
return false;
}
// -->
</SCRIPT>
<body>
<!-- Sending Mail using Domino Collaboration Objects -->
<h1>Sample JSP: Send an email</h1>
<%
boolean ready = ( request.getParameter("sendTo") != null ¦ ¦
request.getParameter("copyTo") != null ¦ ¦
request.getParameter("blindCopyTo") != null );
ready &= (request.getParameter("server") != null);
// System.out.println("Ready: "+ ready);
%>
<!-- <p>Ready is <%= ready %></p> -->
<% if (ready) { /* Needed parameters are present */ %>
<h4>Processing request...</h4>
<jsp:useBean id="s1" class="lotus.dco.beans.DCOSession" />
<%-- <jsp:setProperty name="s1" property="debug" value='<%= true %>' /> --%>
<% try {
s1.login(request.getParameter("server"),
request.getParameter("sender"),
request.getParameter("password"));
} catch (DCOException de) {
throw new ServletException(de.toString(),de);
}
%>
<h4>Opened session for username "<%= s1.getUserName() %>" <br></h4>
<jsp:useBean id="mail1" class="lotus.dco.beans.DCOMail" />
<%-- <jsp:setProperty name="mail1" property="debug" value='<%= true %>' /> --%>
<jsp:setProperty name="mail1" property="dcoSession" value='<%= s1 %>' />
<jsp:setProperty name="mail1" property="*" />
<% try {
mail1.send();
s1.logout();
} catch (DCOException de) {
throw new ServletException(de.toString(),de);
} %>
<h4>Mail sent to
<% if (!(mail1.getSendTo().equals(""))) { %>
<%= "\"" + mail1.getSendTo() + "\"" %>
<% } %>
<% if (!(mail1.getCopyTo().equals(""))) { %>
<%= "\"" + mail1.getCopyTo() + "\"" %>
<% } %>
<% if (!(mail1.getBlindCopyTo().equals(""))) { %>
<%= "\"" + mail1.getBlindCopyTo() + "\"" %>
<% } %>
</h4>
<h4>If you want to, <a href="SendMailJsp.jsp">send another email.</a>
</h4>
<% } else { %>
<CENTER>
<form method="post" onSubmit="return verify(this);">
<TABLE border bgcolor="yellow">
<tr> <th>Sender:</th> <td><input type="text" name="sender" size="30" ></td> </tr>
<tr> <th>Sender's Internet Password:</th> <td><input type="password" name="password" size="30"></td> </tr>
<tr> <th>Sender's Mail Server:</th> <td><input type="text" name="server" size="30"></td> </tr>
<tr><br></tr>
<tr> <th>To:</th> <td><input type="text" name="sendTo" size="30"></td> </tr>
<tr> <th>cc:</th> <td><input type="text" name="copyTo" size="30"></td> </tr>
<tr> <th>bcc:</th> <td><input type="text" name="blindCopyTo" size="30"></td> </tr>
<tr><br></tr>
<tr> <th>Subject:</th> <td><input type="text" name="subject" size="50"></td> </tr>
<tr> <th valign=top>Content:</th> <td><textarea rows="6" name="body" cols="86"></textarea> </td> </tr>
<tr><br></tr>
<tr> <td></td><td><input type="submit" value="Submit" name="B1">
<input type="reset" value="Reset" name="B2"></td> </tr>
</table>
</form>
<SCRIPT LANGUAGE="JavaScript">
document.forms[0].elements[0].focus();
</SCRIPT>
<% } /* end if (ready) */ %>
</body>
</html>
我想先测试一下这个例子,但我没明白Sender's Mail Server该怎么填,是填Domino服务器还是宿主/邮件服务器?Sender该怎么填,是不是用户标识符中显示的姓名?Sender's Internet Password是什么密码,是我用客户端登录时输入的密码吗?
知道这些该怎么填写我才好修改源程序,请各位高手指教!