Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Azure by (4k points)

Can someone please guide me through how to send email from a website hosted in Azure?

1 Answer

0 votes
by (9.6k points)

You can check out Azure's SendGrid Email Service for it over here: https://docs.microsoft.com/en-us/azure/sendgrid-dotnet-how-to-send-email

You can also configure your SMTP client, create a message and send the email.

Follow the given steps to do so :

// create the message
var msg = new MailMessage();
msg.From = new MailAddress("[email protected]"); 
msg.To.Add(strTo); 
msg.Subject = strSubject; 
msg.IsBodyHtml = true; 
msg.Body = strMessage;

// configure the smtp server
var smtp = new SmtpClient("YourSMTPServer"); 
var = new System.Net.NetworkCredential("YourSMTPServerUserName", "YourSMTPServerPassword");

// send the message
smtp.Send(msg); 

Related questions

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...