Mail / SMTP / Authentication [message #1162876] |
Wed, 30 October 2013 13:33  |
Eclipse User |
|
|
|
Is it possible to set the Credentials (username/password) for a SMTP host.
We have two scenarios:
1. Send Mails over the Mail Application Type, there you can configure the Mail Sever in the Mail Application. But no fields for username/password.
2. The Mails that will automtically be sent from stardust on eg. password reset. For this the Mail Server can be configured over the carnot.properties - Mail.Host. But no fields for username/password.
Is it only possible to send Mails over a server without authentication in these two scenarios?
|
|
|
Re: Mail / SMTP / Authentication [message #1163783 is a reply to message #1162876] |
Thu, 31 October 2013 04:00   |
Eclipse User |
|
|
|
Florian,
as you probably know the original SMTP protocol did not cover authentication and instead frequently mail server limit the IPs from which they relay emails or support POP3 before SMTP. That may be the reason why there was little pressure to implement SMTP AUTH so far. That being said, this is not the first time I hear the request and we thought about it but did not get around to adding it due to other higher priorities.
It would not be a difficult change considering that Java already supports it ootb. It should be along those lines:
1. adjust org.eclipse.stardust.engine.extensions.mail.app.MailApplicationInstance to support the additional two parameters in the same way it is already done for the other parameters for instance for the mail sever
2. adjust org.eclipse.stardust.engine.extensions.mail.app.MailAssembler:
private void prepareMsg() throws MessagingException
{
Properties props = new Properties();
props.put("mail.smtp.host", mailHost);
props.put("mail.debug", "true");
props.put("mail.smtp.socketFactory.port", "465");
props.put("mail.smtp.socketFactory.class","javax.net.ssl.SSLSocketFactory");
props.put("mail.smtp.auth", "true");
props.put("mail.smtp.port", "465");
Session session = Session.getInstance(props,
new javax.mail.Authenticator() {
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(this.smtpUsername,this.smtpPassword);
}
});
...
3. add additional fields to Email application type in Modeler
To add auth support to the email notifications sent from events one would probably adjust org.eclipse.stardust.engine.core.runtime.beans.MailHelper adding similar code around line 70.
Feel free to contribute this improvement 
Best regards
Rob
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.07405 seconds