How to test asp.net email is being sent

后端 未结 7 1539
再見小時候
再見小時候 2021-02-09 16:11

I have some code in my asp.net which sends an email:

public void SendEmail(string message)
{
    var body = message;

    var email = new MailMessage(Configurati         


        
7条回答
  •  悲&欢浪女
    2021-02-09 16:37

    to setup an automated test you'll want to have a test email address on a server you can query (since topic is asp.net, we'll assume exchange server), then query the mailbox for the email you're looking for using:

    opt 1: exchange sdk

    opt 2: through web requests (if the exchange server's http connector is enabled

    opt 3: write your own simple pop3 client/cli/api

    ref for opt 3: http://www.codeproject.com/KB/IP/popapp.aspx

提交回复
热议问题