Testing SMTP with .net

后端 未结 17 1281
[愿得一人]
[愿得一人] 2020-12-04 09:54

I need to configure a SMTP server for testing my website which sends emails (for registration confirmation etc).

I dont actually want the email to be sent, I just w

17条回答
  •  醉梦人生
    2020-12-04 10:53

    In .NET, SmtpClient can be configured to send email by placing it in a pickup directory.

    The default constructor of SmtpClient takes its settings from app.config, so for a test environment we can configure it as follows.

    
        
            
                
                    
                
            
        
    
    

    MSDN reference - app.config mailSettings element http://msdn.microsoft.com/en-us/library/w355a94k.aspx

提交回复
热议问题