Why can't i send email from my servlet?

前端 未结 5 608
逝去的感伤
逝去的感伤 2020-12-22 13:12

I am trying to send an email from my servlet. There is no exception but i am not getting email in my account. I am using the following code:

 public class Se         


        
5条回答
  •  有刺的猬
    2020-12-22 13:46

    it seems like mistake is :

    props.put("mail.smtp.host","localhost");
    

    it should not be localhost until you are running mail server on your system..

    look at this question : Using Javamail to connect to Gmail smtp server ignores specified port and tries to use 25

    and yes as commented by Axel try with commandline first

提交回复
热议问题