how to use mailing system in C# [closed]
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and开发者_Go百科 the expected results. See also: Stack Overflow question checklist
Closed 8 years ago.
Improve this questioni want to have an email system , when user done an action after that someone recieve an email in C# so now how I can do that ??
You could use the .Net SmtpClient class as follows:
using System.Net.Mail;
// the e-mail details
String from = "me@server.com";
String to = "someone@server.com";;
// build up the message
MailMessage message = new MailMessage(from, to);
message.Subject = "My Title";
message.Body += "This is the biody of my message";
// create a server pointing to your mail server
String server = "mail.server.com";
// create a client
SmtpClient client = new SmtpClient(server);
client.Credentials = CredentialCache.DefaultNetworkCredentials;
// send the message
client.Send(message);
To send an email in .NET you could use the SmptClient class.
精彩评论