- 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
13 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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 commentaires
Yash Srivastava
le 8 Sep 2022
In order to assist you, I need some more information.
Réponses (0)
Voir également
Catégories
En savoir plus sur Startup and Shutdown dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!