On Tue, 25 Sep 2001 20:18:36 +0200, Lukas Simma wrote:
: i changed the Parameter mail.smtp.host in the server.xml to the Name of the
: Mailserver
: <!-- Test the Mailer Resource -->
: <Resource name="mail/Session" auth="Container"
: type="javax.mail.Session"/>
: <ResourceParams
: name="mail/session">
: <parameter>
: <name>mail.smtp.host</name>
: <value>smtp.ideefix.net</value>
: </parameter>
: </ResourceParams>
: but when i test it with the semdmail example i always get following error.
: It seems that the parameter was not understood because the Exception says it
: is looking on localhost for the mailserver.
I looked at this last week and meant to send an e-mail to the list.
Changing the value of the parameter has no effect because in the
MailSessionFactory class the Session is not getting created using the
value.
I got side-tracked and forgot to send the e-mail.
In catlina they have this class:
org.apache.naming.factory.MailSessionFactory
This is the code in that class that creates the mail Session:
public Object run() {
// Create the JavaMail properties we will use
Properties props = new Properties();
props.put("mail.transport.protocol", "smtp");
props.put("mail.smtp.host", "localhost");
Enumeration attrs = ref.getAll();
while (attrs.hasMoreElements()) {
RefAddr attr = (RefAddr) attrs.nextElement();
if ("factory".equals(attr.getType()))
continue;
props.put(attr.getType(), (String) attr.getContent());
}
// Create and return the new Session object
Session session = Session.getInstance(props, null);
return (session);
}
Looking at the code I thought that Enumeration attrs = ref.getAll( )
would be getting the property for mail.smtp.host and putting into the
Properties variable that is used to create the session.
But, the attributes returned do not have mail.smtp.host in them. I put
some system out statements to print attr.getType and attr.getContent and
this is what I see on the console when I try the sample mail JSP:
In MailSessionFactory::run( ).
attrs.hasMoreElements( ): true
attribute type: scope
attribute content: Shareable
attribute type: auth
attribute content: Container
As far as I can see, the only reason this would ever work would be if
you actually had a mail server running on localhost. And, it only works
then because they are explicity loading the Properties variable with
mail.smtp.host=localhost
--
Mark Miesfeld
[EMAIL PROTECTED]