I have a code in my asp.net that sends an email:
public void SendEmail(string message)
{
var body = message;
var email = new MailMessage(ConfigurationManager.AppSettings["SenderEmail"],
ConfigurationManager.AppSettings["RecipientEmail"],
"Email Test", body);
var client = new SmtpClient();
client.Host = Properties.Settings.Default.smtp;
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.Credentials = CredentialCache.DefaultNetworkCredentials;
client.Send(email);
}
I want to know how to check this. Whether this is a unit test or an integration test, I really don't care. I do not want to scoff at it. I actually want to write a test that the letter is sent with the correct message.
Can anyone help me with this?
source
share