我希望有一个电子邮件系统,当用户完成某个操作后,有人在C#中接收电子邮件 那么现在我该怎么办?
答案 0 :(得分:4)
您可以使用.Net SmtpClient 类,如下所示:
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);
答案 1 :(得分:1)
要在.NET中发送电子邮件,您可以使用SmptClient类。