I have a function which creates a report and sends it to a user. What I\'ve done is create a mock for the email function, and verify if the \'send\' function of the email class
Can be done in following ways.
Step 1: Navigate to your Web.Config
file and add the following tags to it.
Make sure the directory you have specified for pickup location must exist.
Step 2 : Now test your email sending functionality. I have used button_click
to test this functionality with the following code.
SmtpClient smtp = new SmtpClient();
MailMessage message = new MailMessage("me@gmail.com", "me@yahoo.com","My Message Subject","This is a test message");
smtp.Send(message);
Output : It will create .eml
files inside the folder with a randonly generated GUID name, which is the email that we can see after receiving it.
For me it created a file like c127d1d5-255d-4a5a-873c-409e23002eef.eml
in E:\MailTest\
folder
Hope this helps :)