Apache JSP Mailer Tag Error
I have an old java application which used to run under java 4 and an old webserver. It was recently migrated to a new webserver running java 6 and the latest servlet spec. This application has a jsp page with the following snipped:
<%@taglib uri="http://jakarta.apache.org/taglibs/mailer-1.0" prefix="mt"%>
<%
String recipient = "destination@somewhere.org";
%>
<mt:mail to="${recipient}">
<mt:message>hi</mt:message>
</mt:mail>
This throws the following server error under the newer servlet spec/java version:
Could not send the e-mail sent to ${recipient}: Invalid Addresses; nested exception is:
class com.sun.mail.smtp.SMTPAddressFailedException: 550 5.1.1 <${recipient}>... Use开发者_运维百科r unknown
I know that it is bad practice to send email messages directly from a jsp, but I would like to find a minimal fix which lets the jsp page work under the current java servlet spec. Any suggestions?
Shown by the error, apparently the expression ${recipient} is not evaluated to the desired address. Try directly put the e-mail in the attribute "to".
精彩评论