请教:如何在程序中把一些信息发到邮箱里 在自己写的程序中,要把一些信息发送到邮箱中.... 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 public void Email()//发送邮件 { string UserEmail = Request.QueryString["Email"].ToString().Trim().Replace("\'", "\'\'"); System.Net.Mail.MailMessage myMail = new System.Net.Mail.MailMessage(); myMail = new System.Net.Mail.MailMessage("[email protected]", UserEmail);//这里使用的163油箱 myMail.Subject = "!";//邮件发送标题 myMail.Body = "!";//邮件发送内容 System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient("smtp.163.com", 25); client.Credentials = new System.Net.NetworkCredential("XXXXX", "密码");//这里的XXXXX是用户名 client.Send(myMail); } /// <summary> /// 发送邮件 /// </summary> /// <param name="tomail">要发送的邮件地址</param> /// <param name="subject">主题</param> /// <param name="body">内容</param> private void sendMails(string tomail, string subject, string body) { string email_from = System.Configuration.ConfigurationManager.AppSettings["email_from"].ToString(); string email_display_name = System.Configuration.ConfigurationManager.AppSettings["email_display_name"].ToString(); string email_client = System.Configuration.ConfigurationManager.AppSettings["email_client"].ToString(); string username = System.Configuration.ConfigurationManager.AppSettings["username"].ToString(); string password = System.Configuration.ConfigurationManager.AppSettings["password"].ToString(); //Send mail use smtp.163.com server.... MailMessage objMailMessage; objMailMessage = new MailMessage(); objMailMessage.From = new MailAddress(email_from, email_display_name); objMailMessage.To.Add(tomail); objMailMessage.IsBodyHtml = true; objMailMessage.Subject = subject; objMailMessage.Body = body; //Attachment mailattent = new Attachment(fileroad);//添加一个附件 //objMailMessage.Attachments.Add(mailattent); SmtpClient sclient = new SmtpClient(email_client); sclient.Credentials = new System.Net.NetworkCredential(username,password); try { sclient.Send(objMailMessage); } catch (Exception ex) { HttpContext.Current.Response.Write(ex.Message); } } Jquery如何获取select选中项 自定义属性的值? 找遍stackoverflow,没找到答案,那位进来看看? js文件读出后写入大小不一致,且还有格式问题,求助。。。。 .net2005图片不显示 请教一个sql语句问题。 多个人并发访问时候出现奇怪的问题 在线等,如何获取DataGrid隐藏的ID列的值 如何实现手机录音之后,将录音的音频文件上传到服务器上? ★★cuteEditor6.0多语言版(集成lic文件),要得来顶了! 存储过程究竟是什么东西? .net如何连接oracle10g dropdownlist能不能既绑定数据源又添加选择项
{ string UserEmail = Request.QueryString["Email"].ToString().Trim().Replace("\'", "\'\'");
System.Net.Mail.MailMessage myMail = new System.Net.Mail.MailMessage(); myMail = new System.Net.Mail.MailMessage("[email protected]", UserEmail);//这里使用的163油箱
myMail.Subject = "!";//邮件发送标题
myMail.Body = "!";//邮件发送内容 System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient("smtp.163.com", 25);
client.Credentials = new System.Net.NetworkCredential("XXXXX", "密码");//这里的XXXXX是用户名
client.Send(myMail); }
/// 发送邮件
/// </summary>
/// <param name="tomail">要发送的邮件地址</param>
/// <param name="subject">主题</param>
/// <param name="body">内容</param>
private void sendMails(string tomail, string subject, string body)
{
string email_from = System.Configuration.ConfigurationManager.AppSettings["email_from"].ToString();
string email_display_name = System.Configuration.ConfigurationManager.AppSettings["email_display_name"].ToString();
string email_client = System.Configuration.ConfigurationManager.AppSettings["email_client"].ToString();
string username = System.Configuration.ConfigurationManager.AppSettings["username"].ToString();
string password = System.Configuration.ConfigurationManager.AppSettings["password"].ToString(); //Send mail use smtp.163.com server....
MailMessage objMailMessage;
objMailMessage = new MailMessage();
objMailMessage.From = new MailAddress(email_from, email_display_name);
objMailMessage.To.Add(tomail);
objMailMessage.IsBodyHtml = true;
objMailMessage.Subject = subject;
objMailMessage.Body = body;
//Attachment mailattent = new Attachment(fileroad);//添加一个附件
//objMailMessage.Attachments.Add(mailattent); SmtpClient sclient = new SmtpClient(email_client);
sclient.Credentials = new System.Net.NetworkCredential(username,password);
try
{
sclient.Send(objMailMessage);
}
catch (Exception ex)
{
HttpContext.Current.Response.Write(ex.Message);
}
}