EmailSender: failure to send mail if SMTP servers do not use authentication
Opened this issue · 2 comments
Hi all,
When using the EmailSender stage in a pipeline at our hospital, when triggered we get the following error message:
09:37:26 INFO [EmailService] EmailService: Unable to establish connection to 192.168.xxx.xxx
Our SMTP server does not use authentication at the moment.
When debugging through adding a trace on the network packets ( netsh trace start capture=yes IPv4.Address=192.168.xxx.xxx
) and converting the resulting trace file we get the following result in Wireshark.
535 5.7.0 authentication failed
This leads to believe that somehow authentication is triggered.
On the remark on the configuration tab for EmailService, under 'User name' it is mentioned that "If blank, no authentication is done."
If I follow the code, I get to 'CTP/source/java/org/rsna/ctp/stdstages/email/EmailSender.java' on lines 27-41
public EmailSender(String smtpServer, String smtpPort, String senderUsername, String senderPassword, boolean tls) { this.smtpServer = smtpServer; this.senderUsername = senderUsername; this.senderPassword = senderPassword; Properties props = System.getProperties(); props.put("mail.smtp.host", smtpServer); if (smtpPort != null) props.put("mail.smtp.port", smtpPort); props.put("mail.smtp.starttls.enable", Boolean.toString(tls)); if ((senderUsername != null) && (senderPassword != null)) { props.put("mail.smtp.auth", "true");
Is it possible that both senderUsername and senderPassword are evaluated as string and so will allways be evaluated to be True on line 40?
This would trigger authentication to be used always?
Thanks in advance for looking into it (and for the tool in general of course !)
Pieter
Hi John,
thanks so much.
Works as a charm!
Pieter