Cannot use Gmail smtp from Azure Cloud Service

后端 未结 5 1969
星月不相逢
星月不相逢 2020-12-10 12:49

My code for sending email through Gmail\'s smtp:

SmtpClient client = new SmtpClient(\"smtp.gmail.com\", 587);
client.EnableSsl = true;
client.UseDefaultCrede         


        
5条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-10 13:24

    It seems your connection is rejected by the SMTP server either because it is not SSL enabled or the credentials are incorrect. You would need to setup SSL and network credentials in your web.config as below:

    
     
        
            
        
     
    
    

    More info is available in this SO discussion: C# - Can't send mail in WIndows Azure via Gmail SMTP

提交回复
热议问题