Hi,
I would like to enable email sending using Apama. I have already configured the email server according to the documentation ( Customizing your platform - Cumulocity documentation) and created a simple model in Analytics Builder.
However, after sending an event, the email did not appear in my inbox.
I checked the apama-ctrl logs, but I couldn’t find any relevant information there. Only after inspecting the logs in the c8y-core pod, I found the following exception:
2025-04-02T09:27:54.357747942+02:00 stdout F 2025-04-02 07:27:54.354[send-mail-3 ]-/ | | EmailEndpointJavaMail | 83 - com.nsn.cumulocity.platform-services.email-management.service - 1018.0.457 | ERROR Error while sending email for tenant edge from [gmail.com] to [company123.com]
2025-04-02T09:27:54.357846469+02:00 stdout F java.lang.Exception: org.springframework.mail.MailSendException: Mail server connection failed; nested exception is com.sun.mail.util.MailConnectException: Couldn't connect to host, port: smtp.gmail.com, 587; timeout 10000;
2025-04-02T09:27:54.357861226+02:00 stdout F nested exception is:
2025-04-02T09:27:54.357867575+02:00 stdout F java.net.SocketTimeoutException: connect timed out. Failed messages: com.sun.mail.util.MailConnectException: Couldn't connect to host, port: smtp.gmail.com, 587; timeout 10000;
2025-04-02T09:27:54.357872642+02:00 stdout F nested exception is:
2025-04-02T09:27:54.357877788+02:00 stdout F java.net.SocketTimeoutException: connect timed out; message exceptions (1) are:
2025-04-02T09:27:54.357901889+02:00 stdout F Failed message 1: com.sun.mail.util.MailConnectException: Couldn't connect to host, port: smtp.gmail.com, 587; timeout 10000;
2025-04-02T09:27:54.357909096+02:00 stdout F nested exception is:
2025-04-02T09:27:54.357914617+02:00 stdout F java.net.SocketTimeoutException: connect timed out
2025-04-02T09:27:54.357919728+02:00 stdout F at com.cumulocity.email.service.impl.EmailEndpointJavaMail.lambda$send$1(EmailEndpointJavaMail.java:78) ~[?:?]
2025-04-02T09:27:54.357924505+02:00 stdout F at org.springframework.retry.support.RetryTemplate.handleRetryExhausted(RetryTemplate.java:512) ~[?:?]
2025-04-02T09:27:54.357929829+02:00 stdout F at org.springframework.retry.support.RetryTemplate.doExecute(RetryTemplate.java:351) ~[?:?]
2025-04-02T09:27:54.357934409+02:00 stdout F at org.springframework.retry.support.RetryTemplate.execute(RetryTemplate.java:180) ~[?:?]
2025-04-02T09:27:54.357938942+02:00 stdout F at com.cumulocity.email.service.impl.EmailEndpointJavaMail.lambda$send$2(EmailEndpointJavaMail.java:71) ~[?:?]
2025-04-02T09:27:54.357943488+02:00 stdout F at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[?:?]
2025-04-02T09:27:54.357948167+02:00 stdout F at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[?:?]
2025-04-02T09:27:54.357952884+02:00 stdout F at java.lang.Thread.run(Thread.java:829) [?:?]
2025-04-02T09:27:54.357957337+02:00 stdout F Caused by: org.springframework.mail.MailSendException: Mail server connection failed; nested exception is com.sun.mail.util.MailConnectException: Couldn't connect to host, port: smtp.gmail.com, 587; timeout 10000;
2025-04-02T09:27:54.35796193+02:00 stdout F nested exception is:
2025-04-02T09:27:54.357981252+02:00 stdout F java.net.SocketTimeoutException: connect timed out. Failed messages: com.sun.mail.util.MailConnectException: Couldn't connect to host, port: smtp.gmail.com, 587; timeout 10000;
2025-04-02T09:27:54.357987763+02:00 stdout F nested exception is:
2025-04-02T09:27:54.357993242+02:00 stdout F java.net.SocketTimeoutException: connect timed out
2025-04-02T09:27:54.357997977+02:00 stdout F at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:433) ~[?:?]
2025-04-02T09:27:54.35800245+02:00 stdout F at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:346) ~[?:?]
2025-04-02T09:27:54.358006921+02:00 stdout F at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:341) ~[?:?]
2025-04-02T09:27:54.358011666+02:00 stdout F at com.cumulocity.email.service.impl.EmailEndpointJavaMail.lambda$send$0(EmailEndpointJavaMail.java:73) ~[?:?]
2025-04-02T09:27:54.358016363+02:00 stdout F at org.springframework.retry.support.RetryTemplate.doExecute(RetryTemplate.java:287) ~[?:?]
2025-04-02T09:27:54.358020942+02:00 stdout F ... 5 more
2025-04-02T09:27:54.358025585+02:00 stdout F Caused by: com.sun.mail.util.MailConnectException: Couldn't connect to host, port: smtp.gmail.com, 587; timeout 10000
2025-04-02T09:27:54.358035464+02:00 stdout F at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:2210) ~[?:?]
2025-04-02T09:27:54.358040517+02:00 stdout F at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:722) ~[?:?]
2025-04-02T09:27:54.358045209+02:00 stdout F at javax.mail.Service.connect(Service.java:342) ~[?:?]
2025-04-02T09:27:54.358065615+02:00 stdout F at org.springframework.mail.javamail.JavaMailSenderImpl.connectTransport(JavaMailSenderImpl.java:503) ~[?:?]
2025-04-02T09:27:54.358071273+02:00 stdout F at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:422) ~[?:?]
2025-04-02T09:27:54.358076215+02:00 stdout F at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:346) ~[?:?]
2025-04-02T09:27:54.358080796+02:00 stdout F at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:341) ~[?:?]
2025-04-02T09:27:54.358085465+02:00 stdout F at com.cumulocity.email.service.impl.EmailEndpointJavaMail.lambda$send$0(EmailEndpointJavaMail.java:73) ~[?:?]
2025-04-02T09:27:54.358090644+02:00 stdout F at org.springframework.retry.support.RetryTemplate.doExecute(RetryTemplate.java:287) ~[?:?]
2025-04-02T09:27:54.358095213+02:00 stdout F ... 5 more
2025-04-02T09:27:54.358101596+02:00 stdout F Caused by: java.net.SocketTimeoutException: connect timed out
2025-04-02T09:27:54.358106603+02:00 stdout F at java.net.PlainSocketImpl.socketConnect(Native Method) ~[?:?]
2025-04-02T09:27:54.358111133+02:00 stdout F at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:412) ~[?:?]
2025-04-02T09:27:54.358115452+02:00 stdout F at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:255) ~[?:?]
2025-04-02T09:27:54.35811979+02:00 stdout F at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:237) ~[?:?]
2025-04-02T09:27:54.35817686+02:00 stdout F at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[?:?]
2025-04-02T09:27:54.358185777+02:00 stdout F at java.net.Socket.connect(Socket.java:609) ~[?:?]
2025-04-02T09:27:54.35819054+02:00 stdout F at com.sun.mail.util.WriteTimeoutSocket.connect(WriteTimeoutSocket.java:91) ~[?:?]
2025-04-02T09:27:54.358194928+02:00 stdout F at com.sun.mail.util.SocketFetcher.createSocket(SocketFetcher.java:333) ~[?:?]
2025-04-02T09:27:54.358199574+02:00 stdout F at com.sun.mail.util.SocketFetcher.getSocket(SocketFetcher.java:214) ~[?:?]
2025-04-02T09:27:54.358204268+02:00 stdout F at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:2160) ~[?:?]
2025-04-02T09:27:54.358208577+02:00 stdout F at com.sun.mail.smtp.SMTPTransport.protocolConnect(SMTPTransport.java:722) ~[?:?]
2025-04-02T09:27:54.358212845+02:00 stdout F at javax.mail.Service.connect(Service.java:342) ~[?:?]
2025-04-02T09:27:54.358217326+02:00 stdout F at org.springframework.mail.javamail.JavaMailSenderImpl.connectTransport(JavaMailSenderImpl.java:503) ~[?:?]
2025-04-02T09:27:54.35822175+02:00 stdout F at org.springframework.mail.javamail.JavaMailSenderImpl.doSend(JavaMailSenderImpl.java:422) ~[?:?]
2025-04-02T09:27:54.358226006+02:00 stdout F at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:346) ~[?:?]
2025-04-02T09:27:54.358230318+02:00 stdout F at org.springframework.mail.javamail.JavaMailSenderImpl.send(JavaMailSenderImpl.java:341) ~[?:?]
2025-04-02T09:27:54.358251484+02:00 stdout F at com.cumulocity.email.service.impl.EmailEndpointJavaMail.lambda$send$0(EmailEndpointJavaMail.java:73) ~[?:?]
2025-04-02T09:27:54.358256577+02:00 stdout F at org.springframework.retry.support.RetryTemplate.doExecute(RetryTemplate.java:287) ~[?:?]
2025-04-02T09:27:54.358261224+02:00 stdout F ... 5 more
We are running Edge on Kubernetes.
Do you know what might be causing this issue with sending emails?
Thanks for your help!