在C#中,怎么讲用户输入的信息,上传到自己的邮箱中,

来源:百度知道 编辑:UC知道 时间:2024/06/01 11:17:29
要放在什么位置上,?

Using System.net.mail;
to 要发送到的地址
from你的信箱地址
subject 信件主题
body信件内容
userName信箱用户名
password信箱密码
smtpHost smtp

public void Send(string to, string from, string subject, string body, string userName, string password, string smtpHost)
{
MailAddress From = new MailAddress(from);
MailAddress To = new MailAddress(to);
MailMessage message = new MailMessage(From, To);
message.Subject = subject;
message.IsBodyHtml = true;
message.Body = body;
SmtpClient client = new SmtpClient(smtpHost);
client.Credentials = new NetworkCredential(userName, password);
client.Send(message);
}
---------------------------------------------

就是一个方法
放在你的代码页面内就可以了.