You can set starttls in the properties. This must be done in the Java action.
To get the path use Core.getConfiguration().getTempPath();
Regards,
Ronald
Perhaps I'm approaching this the wrong way... How can I make us of the Mendix Email module class and "mail" method which allows the attachment lists directly with Mendix objects and make use of the TLS settings like the following?
Properties props = new Properties();
props.put("mail.smtp.host", this.SMTPHost); //SMTP Host
props.put("mail.smtp.port", ( this.SMTPPort != null ? this.SMTPPort.intValue() : 25)); //TLS Port
props.put("mail.smtp.auth", "true"); //enable authentication
props.put("mail.smtp.starttls.enable", "true"); //enable STARTTLS
//create Authenticator object to pass in Session.getInstance argument
Authenticator auth = new Authenticator() {
//override the getPasswordAuthentication method
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication((SMTPUserName != null ? SMTPUserName : "" ), (SMTPPassword != null ? SMTPPassword : "" ));
}
};
Session mailSession = Session.getInstance(props, auth);
If I use the usual smtpConfiguration, office365 smtp server doesn't authenticate the user, because the mendix mail method doesn't seem to handle properly tls, so how can I do this?
If I don't use the mail method, and use the properties as above and send email with MimeMessage and Transport.send(message), I can email correctly as long as I don't have attachments, because as soon as I add attachments, I cannot get the file path.
So, what would you guys suggest? Personally, I would rather use the mendix email module class, but I'm stuck either way. LR.