Anyone that knows how to send a mail using the JavaMail-api from a ejb-bean
in JBoss using a SMTP-server that require authentication?
I have no problem sending mail using an open SMTP-server but I can't figure
out how to give the SMTP-server authentication information when required.
I'm using JBoss3.2-beta3 and have tried two ways without success:
1. Configuring the mail-service by setting a valid username and password for
the smtp-server in the mail-configuration:
<mbean code="org.jboss.mail.MailService"
name="jboss:service=MyMail">
<attribute name="JNDIName">java:/mail/MyMailSession</attribute>
<attribute name="User">smtpuser</attribute>
<attribute name="Password">smtppassword</attribute>
<attribute name="Configuration">
<configuration>
<!-- Enable authentication on the SMTP gateway server -->
<property name="mail.smtp.auth" value="true"/>
2. Adding authentication code in the ejb-bean:
Changing:
Transport.send(msg);
To:
Transport transport = session.getTransport("smtp");
transport.connect("smtphost", "smtpuser", "smtppassword");
msg.saveChanges();
transport.sendMessage(msg, msg.getAllRecipients());
transport.close();
In case 2, I get the following exception from the connect-call:
javax.mail.AuthenticationFailedException
Any hits?
Regards,
Magnus.
-------------------------------------------------------
This SF.NET email is sponsored by: Take your first step towards giving
your online business a competitive advantage. Test-drive a Thawte SSL
certificate - our easy online guide will show you how. Click here to get
started: http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0027en
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user