- Can you provide the complete error message?
- Is the network connected through a proxy?
Trouble with sending emails - Can't send command to SMTP host
12 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
SOLVED
Hello all,
I am currently using sendmail function on MATLAB R2022a to periodically send emails to designated email adresses. I created a graphical user interface and performed numerous trials which were successful and working smoothly. However, after compiling it to be a standalone application and deployed it to another computer connected to another network, it started throwing the following error:
Identifier:
MATLAB:sendmail:SmtpError
Message:
Can't send command to SMTP host;sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
The very same SMTP configuration (server, adress, password, port) works without any trouble on my computer. But it throws the error above on another computer. This makes me think that the code is properly working and the problem is with other computers network. My initial guess was that Windows firewall was blocking the email transfer, so I added a new rule to inbound and outbound rules for the standalone application, which didn't work.
However, maybe I should have added the rule as port. I will be trying this as soon as possible.
The computer has an antivirus software which might also be blocking the transfer. I will temporarily disable the antivirus and then try. If it works, I will be adding an exception to the antivirus so that it allows the application.
Do you have any idea on what the problem and other possible solutions might be?
I thank you for your answers in advance.
Solution for my case:
The issue was related to the server certification, so I added the following line of code to make sure that it trusts the server regardless of its certification:
props.setProperty('mail.smtp.ssl.trust', '*')
2 comentarios
Yash Srivastava
el 8 de Sept. de 2022
In order to assist you, I need some more information.
Respuestas (0)
Ver también
Categorías
Más información sobre Startup and Shutdown en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!