Discussion:
[xwiki-devs] Issue with authenticated SMTP servers for "Admin Email" setting in Xwiki
Niels Mayer
2009-01-13 17:43:08 UTC
Permalink
If I want to use smtp.gmail.com as my "Admin Email" preference set in
http://localhost:8080/xwiki/bin/admin/XWiki/XWikiPreferences?editor=globaladmin&section=General;
the editor doesn't have the required fields or capabilities to provide
"authenticated SMTP" required by Gmail and numerous other mail providers per
http://mail.google.com/support/bin/answer.py?hl=en&answer=13287 ::

*Outgoing Mail (SMTP) Server - requires TLS:* smtp.gmail.com (use
authentication)
*Use Authentication*: Yes
*Use STARTTLS*: Yes (some clients call this SSL)
*Port*: 465 or 587
The error message emitted from "registration" indicates what's missing to
support authenticated SMTP:

Error number 10006 in 10: Could not send mail to server smtp.gmail.com
port 25 error code 530 (530 5.7.0 Must issue a STARTTLS command first.
27sm1167462wff.51
com.xpn.xwiki.XWikiException: Error number 10006 in 10: Could not send
mail to server smtp.gmail.com port 25 error code 530 (530 5.7.0 Must
issue a STARTTLS command first. 27sm1167462wff.51

Are there any plans to support this for 1.8 rc1 ? (I'm using 1.8 trunk, rev
15391)

It's not essential to do this, but it could end up being a fair amount of
extra admin work to get it working. One workaround would be to setup a local
SMTP server (bind only to localhost), set the
"Admin email" pref to 127.0.0.1 and then have the local SMTP server use TLS
to communicate with your organization's secure SMTP server.

Note that this issue is broader than just TLS-based SMTP. Most other SMTP
servers are no longer open and unauthenticated due to the issue of spam and
mail forgery. Setting up Xwiki with such an SMTP server results in the
following error on registration:

Error number 10006 in 10: Could not send mail to server
smtp.kawlich.eduport 25 error code 550 (550 5.7.1 ... Relaying denied.
Proper authentication
required.
com.xpn.xwiki.XWikiException: Error number 10006 in 10: Could not send mail
to server smtp.kawlich.edu port 25 error code 550 (550 5.7.1 ... Relaying
denied.
Niels
http://nielsmayer.com
Sergiu Dumitriu
2009-01-14 02:49:22 UTC
Permalink
Post by Niels Mayer
If I want to use smtp.gmail.com as my "Admin Email" preference set in
http://localhost:8080/xwiki/bin/admin/XWiki/XWikiPreferences?editor=globaladmin&section=General;
the editor doesn't have the required fields or capabilities to provide
"authenticated SMTP" required by Gmail and numerous other mail providers per
*Outgoing Mail (SMTP) Server - requires TLS:* smtp.gmail.com (use
authentication)
*Use Authentication*: Yes
*Use STARTTLS*: Yes (some clients call this SSL)
*Port*: 465 or 587
The error message emitted from "registration" indicates what's missing to
Error number 10006 in 10: Could not send mail to server smtp.gmail.com
port 25 error code 530 (530 5.7.0 Must issue a STARTTLS command first.
27sm1167462wff.51
com.xpn.xwiki.XWikiException: Error number 10006 in 10: Could not send
mail to server smtp.gmail.com port 25 error code 530 (530 5.7.0 Must
issue a STARTTLS command first. 27sm1167462wff.51
Are there any plans to support this for 1.8 rc1 ? (I'm using 1.8 trunk, rev
15391)
It's not essential to do this, but it could end up being a fair amount of
extra admin work to get it working. One workaround would be to setup a local
SMTP server (bind only to localhost), set the
"Admin email" pref to 127.0.0.1 and then have the local SMTP server use TLS
to communicate with your organization's secure SMTP server.
Note that this issue is broader than just TLS-based SMTP. Most other SMTP
servers are no longer open and unauthenticated due to the issue of spam and
mail forgery. Setting up Xwiki with such an SMTP server results in the
Error number 10006 in 10: Could not send mail to server
smtp.kawlich.eduport 25 error code 550 (550 5.7.1 ... Relaying denied.
Proper authentication
required.
com.xpn.xwiki.XWikiException: Error number 10006 in 10: Could not send mail
to server smtp.kawlich.edu port 25 error code 550 (550 5.7.1 ... Relaying
denied.
The mailsender plugin uses JavaMail as the internal mail sender. Reading
a bit about the SSL/TLS support in it, I found that basically what you
need to do is define mail.smtp.starttls.enable=true.

http://java.sun.com/products/javamail/javadocs/com/sun/mail/smtp/package-summary.html
also lists mail.smtp.ssl.protocols and mail.smtp.ssl.ciphersuites as
SSL-related properties.

Also, in order to be able to use secure sockets, the JSSE library must
be present in the classpath (I think it is with standard JDKs), and the
host must be able to accept the server's certificate.

About the configuration part, the mailsender uses the
javamail_extra_props property in your global XWikiPreferences as a
standard .properties file (you will need to define it in the
XWikiPreferences class, as a TextArea property).

So, basically what you need to do is:

1. Edit the XWiki.XWikiPreferences class and add a TextArea property
named javamail_extra_props
2. Edit the XWiki.XWikiPreferences object and enter in it:
mail.smtp.starttls.enable=true
3. Find out what else needs to be done on the JVM side to make TLS work.
--
Sergiu Dumitriu
http://purl.org/net/sergiu/
Loading...