[
http://jira.xwiki.org/jira/browse/XWIKI-950?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_22234
]
Przemyslaw Bielicki commented on XWIKI-950:
-------------------------------------------
Why using commons SMTP instead of commons Email? With commons-email sending an
email with SMTP authentication is piece of cake.
What is needed in pom.xml:
{code:xml}
<dependencies>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-email</artifactId>
<version>1.1</version>
</dependency>
</dependencies>
{code}
In {{com.xpn.xwiki.XWiki}} class you should remove {{SMTPClient}} stuff
({{public void sendMessage(...)}} method(s)) and put something like this:
{code:java}
SimpleEmail email = new SimpleEmail();
email.setHostName("smtp.server.com");
email.addTo("[EMAIL PROTECTED]", "User Data");
email.setFrom("[EMAIL PROTECTED]", "XWiki Admin");
email.setSubject("Taken from XWiki config?");
email.setMsg("Message body");
// SMTP server will probably require authentication
email.setAuthentication("admin", "password");
email.send();
{code}
Guys, I'm not criticizing you but, please refactor
[com.xpn.xwiki.XWiki|http://svn.xwiki.org/svnroot/xwiki/xwiki-platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/XWiki.java]
class - it has over *6k* lines of code :)
> eMail (XWiki.sendMessage) defaults to illegal SMTP HELO
> -------------------------------------------------------
>
> Key: XWIKI-950
> URL: http://jira.xwiki.org/jira/browse/XWIKI-950
> Project: XWiki Platform
> Issue Type: Bug
> Components: Other
> Affects Versions: 1.0 B5
> Environment: Linux Java1.5 Java1.6 Tomcat55 PostgreSql
> Reporter: Tom Oehser
> Fix For: Future
>
> Original Estimate: 1 day
> Remaining Estimate: 1 day
>
> SMTP HELO must (according to SMTP spec) be a Domain, (like 'jira.xwiki.org').
> Xwiki is defaulting it (if smtp_login is not set) to "XWiki
> VersionInformation" in XWiki.sendMessage().
> Probably it should use InetAddress.getLocalHost().getHostName() for the
> default domain.
> It might not even need the smtp_login configuration,
> InetAddress.getLocalHost().getHostName() may always be correct for the SMTP
> HELO.
> This was discovered because the Exim4 MTA is smart enough to reject
> HELO XWiki version 1.0-beta-5.2310
> -Tom
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.xwiki.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
_______________________________________________
notifications mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/notifications