How to send an email from my C# codebehind - Getting System.Net.Mail.SmtpFailedRecipientException

前端 未结 3 396
[愿得一人]
[愿得一人] 2021-01-22 02:23

I have a webform where someone can set up an account - I want to send them an email confirmation.

The code I\'m using:

       // Create e-mail message
           


        
3条回答
  •  攒了一身酷
    2021-01-22 02:56

    Your client code looks fine, the problem may be in web.config:

    host="mail.OurOrganisationEmail@ourdomain.com"
    

    it's an email address, not a valid hostname it should look like this:

    host="mail.ourdomain.com"
    

    Have you tested if the smtp server works ? just make some basic tests using telnet. http://technet.microsoft.com/en-us/library/aa995718(v=exchg.65).aspx

    also, check this post for additional info Send Email via C# through Google Apps account

提交回复
热议问题