asp.net电子商务设计中,用户下完订单后,怎样将生成的“订单号”转发到...
发布网友
发布时间:2024-10-24 13:21
我来回答
共1个回答
热心网友
时间:2024-10-27 06:18
用下面的发送邮件方法就行了,将邮件内容设为订单号就ok啦
#region 发送邮件
System.Net.Mail.MailMessage objMailMessage;
//Attachment objMailAttachment;
// 创建一个附件对象
//objMailAttachment = new Attachment("d:\\test.txt");//发送邮件的附件
// 创建邮件消息
objMailMessage = new System.Net.Mail.MailMessage();
objMailMessage.From = new MailAddress("发送邮件地址");//你自己的邮箱地址 要开通smtp服务
objMailMessage.To.Add("用户邮件地址");//目的邮件地址
objMailMessage.Subject = "邮件发送标题:你好!";//发送邮件的标题
objMailMessage.Body = "邮件发送标内容:测试一下是否发送成功!";//发送邮件的内容
objMailMessage.IsBodyHtml = true;
objMailMessage.BodyEncoding = System.Text.Encoding.UTF8;
objMailMessage.Priority = System.Net.Mail.MailPriority.Normal;
//objMailMessage.Attachments.Add(objMailAttachment);//将附件附加到邮件消息对象中
//SMTP地址
SmtpClient smtpClient = new SmtpClient("smtp.qq.com");//网络上的代理服务器
//smtpClient.EnableSsl = true;
smtpClient.Credentials = new System.Net.NetworkCredential("邮箱登陆账号", "邮箱登陆密码");//设置发件人身份的信息
smtpClient.DeliveryMethod = System.Net.Mail.SmtpDeliveryMethod.Network;
smtpClient.Host = "smtp." + objMailMessage.From.Host;
smtpClient.Send(objMailMessage);
#endregion