GMail + C# + Web.Config: Send Mail Works Programmatically, Throws Exception Using Web.Config Values

后端 未结 6 546
执笔经年
执笔经年 2020-12-14 19:16

Given the following section in Web.Config:


    
        

        
6条回答
  •  难免孤独
    2020-12-14 19:34

    There is no way to specify whether a SSL / Secure connection should be used when defining the mail settings in the web config file.

    I'm pretty sure that's why you get an error.

    One way to solve that is to create your own mail sending wrapper, and then using it in your application, but you probably already got that :)

    It gets more complicated when using the .net membership controls, like forgot password, create user etc. A way to solve that, is to override the SendingMail event, and then set the EnableSSL property of the mailclient to true.

    I hope i was able to help :)

提交回复
热议问题