Click here to Skip to main content
15,867,686 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi all,
I am newbie to ASP.NET and now start learning MVC , to enhance my skills on .NET platform . Currently , i am practicing myself to do different task & pretty much know about MVC and eager to know how we can send email to client mailbox by using MVC5 . Can anyone share any link or blog ; from where i can learn and implement it . I read two or three articles but I don't understand the code properly how to use web helper class to implement it.

What I have tried:

Kindly share me the link , so that i can implement it ; i am highly appreciate for the same.
Posted
Updated 20-Nov-20 2:52am

1 solution

refer
[^]

string to = "jane@contoso.com";
	string from = "ben@contoso.com";
	MailMessage message = new MailMessage(from, to);
	message.Subject = "Using the new SMTP client.";
	message.Body = @"Using this new feature, you can send an e-mail message from an application very easily.";
	SmtpClient client = new SmtpClient(server);
	// Credentials are necessary if the server requires the client 
	// to authenticate before it will send e-mail on the client's behalf.
	client.UseDefaultCredentials = true;

    try {
	  client.Send(message);
	}  
	catch (Exception ex) {
	  Console.WriteLine("Exception caught in CreateTestMessage2(): {0}", 
                  ex.ToString() );			  
    }              
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900