Unable to configure Container Mail / Session factory with custom Host, Port, 
User, and Password
-----------------------------------------------------------------------------------------------

                 Key: JSPWIKI-102
                 URL: https://issues.apache.org/jira/browse/JSPWIKI-102
             Project: JSPWiki
          Issue Type: Bug
          Components: Core & storage
    Affects Versions: 2.6.0
         Environment: Tomcat 5.5, JRE 1.6, WinXP
            Reporter: Dave Wolf


For weeks, I've been attempting to get the Mail session factory working in 
Tomcat 5.5.25. I can't get the container to recognize the non-localhost SMTP 
host and port. Since I'm running JRE 1.6, I've removed the activation.jar from 
the WEB-INF/lib and moved the most recent version of the mail.jar to 
<CATALINA_HOME>/commons/lib.

In my jspwiki.properties file, I have:

#  JNDI resource name. The commented-out value is the default
jspwiki.mail.jndiname = mail/Session

#  B. Stand-alone Resource Factory. JSPWiki will use these values if JNDI fails.
#
#  Your SMTP host (i.e. the one which sends email)
# mail.smtp.host = 127.0.0.1

# If for some reason the standard smtp port (25) is blocked, you can change it 
here
# mail.smtp.port = 25

#  The address from which the email appears to come
mail.from =JSPWiki <[EMAIL PROTECTED]>

# If you are using a webserver that is publically accessible it usually
# doesn't allow you to send mail anonymously
# (because then this mailserver would become an open relay).
# Therefore you can indicate your account information here...
#
# mail.smtp.account =
# mail.smtp.password =

# The properties below control connection timeouts and TLS (encryption)
# if the mailserver supports it. The commented-out values are the defaults.
# mail.smtp.timeout = 5000
# mail.smtp.connectiontimeout = 5000
# mail.smtp.starttls.enable = tru

Currently, in server.xml I have:

 <Resource name="mail/Session" auth="CONTAINER" type=" javax.mail.Session"/>
    <ResourceParams name="mail/Session">
    <parameter>
             <name>factory</name>
            <value>org.apache.naming.factory.MailSessionFactory </value>
        </parameter>
    <parameter>
            <name>mail.smtp.host</name>
            <value>smtp-********.com</value>
        </parameter>
    <parameter>
            <name>mail.smtp.port</name>
            <value>6225</value>
        </parameter>
    <parameter>
            <name>mail.smtp.account</name>
            <value>************</value>
        </parameter>
    <parameter>
            <name>mail.smtp.password</name>
            <value>**********</value>
        </parameter>
    <parameter>
            <name>mail.smtp.timeout</name>
            <value>5000</value>
        </parameter>
    <parameter>
            <name>mail.smtp.connectiontimeout</name>
            <value>5000</value>
        </parameter>
    <parameter>
            <name>mail.smtp.starttls.enable</name>
            <value>true</value>
        </parameter>
    </ResourceParams>

Previously, I tried this instead:

    <Resource name="mail/Session" auth="Container"
        type="javax.mail.Session"
        mail.smtp.host= "smtp-*******.com"
        mail.smtp.port="6225"
        mail.smtp.account="***************"
        mail.smtp.password="**************"
        mail.smtp.timeout="5000"
        mail.smtp.connectiontimeout="5000"
        mail.smtp.starttls.enable="true"/>

Neither configuration works, I'm getting the messages from JSPWiki in the 
jspwiki.log:

 [EMAIL PROTECTED]:40:17 INFO SecurityLog Wiki:/Wiki/Login.jsp 
Wiki:http://localhost:8080/Wiki/Login.jsp - 
WikiSecurityEvent.LOGIN_AUTHENTICATED [EMAIL PROTECTED] , 
princpal=com.ecyrd.jspwiki.auth.WikiPrincipal dave.wolf, [EMAIL PROTECTED]

 [EMAIL PROTECTED]:40:17 INFO JSPWiki Wiki:/Wiki/Login.jsp 
Wiki:http://localhost:8080/Wiki/Login.jsp - Successfully authenticated user 
dave.wolf (custom auth)

 [EMAIL PROTECTED]:40:17 INFO JSPWiki Wiki:/Wiki/Login.jsp 
Wiki:http://localhost:8080/Wiki/Login.jsp - Redirecting user to 
http://localhost:8080/Wiki/Wiki.jsp?page=ApprovalRequiredForUserProfiles

 [EMAIL PROTECTED]:40:30 INFO com.ecyrd.jspwiki.auth.user.AbstractUserDatabase 
Wiki:/Wiki/Workflow.jsp Wiki:http://localhost:8080/Wiki/Workflow.jsp - Creating 
new user test5

 [EMAIL PROTECTED]:40:31 ERROR com.ecyrd.jspwiki.util.MailUtil 
Wiki:/Wiki/Workflow.jsp Wiki: http://localhost:8080/Wiki/Workflow.jsp - 
javax.mail.MessagingException: Could not connect to SMTP host: localhost, port: 
25;
  nested exception is:
    java.net.ConnectException : Connection refused: connect

 [EMAIL PROTECTED]:40:32 ERROR com.ecyrd.jspwiki.auth.UserManager 
Wiki:/Wiki/Workflow.jsp Wiki:http://localhost:8080/Wiki/Workflow.jsp - Could 
not send registration confirmation e-mail. Is the e-mail server running? 

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to