Problem Description: Email notification task in a workflow fails with the below error in the /opt/infoworks/platform/logs/messaging-service.log file


2019-09-17 13:30:19,817 ERROR [vert.x-eventloop-thread-0] service.EmailService:136 : Failed to send email
javax.mail.AuthenticationFailedException: 535-5.7.8 Username and Password not accepted. Learn more at
535 5.7.8 https://support.google.com/mail/?p=BadCredentials d133sm1227553qkg.31 - gsmtp

at com.sun.mail.smtp.SMTPTransport$Authenticator.authenticate(SMTPTransport.java:965)
at com.sun.mail.smtp.SMTPTransport.authenticate(SMTPTransport.java:876)
at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:780)
at javax.mail.Service.connect(Service.java:388)
at javax.mail.Service.connect(Service.java:246)
at javax.mail.Service.connect(Service.java:195)
at javax.mail.Transport.send0(Transport.java:254)
at javax.mail.Transport.send(Transport.java:124)
at io.infoworks.platform.messaging.service.EmailService.lambda$sendMessage$0(EmailService.java:124)
at io.vertx.core.impl.ContextImpl.lambda$executeBlocking$2(ContextImpl.java:272)
at io.vertx.core.impl.TaskQueue.run(TaskQueue.java:76)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:748)


Root cause: This is a limitation in Infoworks v2.8.0 and there is a JIRA IPD-8614 raised for this issue.


Workaround: Perform the below steps and then run the workflow again.

a) cd $IW_HOME/bin

b) Open the generate_platform_config.sh file

c) Get your SMTP settings from the below section. Below is the snapshot showing the sample configurations.


"email.settings": 

{


"smtpHost": "outlook.office365.com",


"smtpPort": 587,


"smtpUsername": "xxxxxxxxxxxx",


"smtpPassword": "xxxxxxxxxxxxx",


"ttlsEnabled": false,


"sslEnabled": false,


"sslPort": 465


}


d) Go to /opt/infoworks/bin/start-iw-services/core/iw_utils.py and remove the default SMTP settings and configure your SMTP details.


Before Change


dic["messaging-service"]["email.settings"] = {}
dic["messaging-service"]["email.settings"][
"smtpHost"] = "smtp.gmail.com"
dic["messaging-service"]["email.settings"]["smtpPort"] = 587
dic["messaging-service"]["email.settings"][
"smtpUsername"] = "postman@infoworks.io"
dic["messaging-service"]["email.settings"][
"smtpPassword"] = "qCfOEcltJ9moLFp0XjMhsLuXmq1NMSyr6yzlcXczTJA="
dic["messaging-service"]["email.settings"]["ttlsEnabled"] = False
dic["messaging-service"]["email.settings"]["sslEnabled"] = True
dic["messaging-service"]["email.settings"]["sslPort"] = 465


After Change


dic["messaging-service"]["email.settings"] = {}
dic["messaging-service"]["email.settings"][
"smtpHost"] = "outlook.office365.com"
dic["messaging-service"]["email.settings"]["smtpPort"] = 587
dic["messaging-service"]["email.settings"][
"smtpUsername"] = "xxxxxxxxxxxxxxx"
dic["messaging-service"]["email.settings"][
"smtpPassword"] = "xxxxxxxxxxxxxxxxx"
dic["messaging-service"]["email.settings"]["ttlsEnabled"] = False
dic["messaging-service"]["email.settings"]["sslEnabled"] = True
dic["messaging-service"]["email.settings"]["sslPort"] = 465


e) source /opt/infoworks/bin/env.sh

f) /opt/infoworks/bin/stop.sh platform

g) /opt/infoworks/bin/start.sh platform




Applicable IWX versions


IWX v2.8.0