//邮件内容
protected void SendEmail()
{
try
{
//发送邮件,要记得到邮箱中设置接收SMTP邮件
string strSmtpServer = "mail.vline.net.cn";
string strFrom = "*******@vline.net.cn";
string strFromPass = "123456";
string strto ="*******@vline.net.cn";
string strSubject = "未来科技保证金到期提醒";
//strBody
System.Text.StringBuilder strBody = new System.Text.StringBuilder();
strBody.Append("亲爱的用户,您好:");
strBody.AppendLine("<p/>");
strBody.Append(" 您有即将到期的信息,具体情况见附件,请尽快查看并予以处理!");
strBody.Append(" 该邮件由系统自动发出,请不要回复。");
SendSMTPEmail(strSmtpServer, strFrom, strFromPass, strto, strSubject, strBody.ToString(),);
}
catch ()
{
}
}
//SMTP发送邮件
public static void SendSMTPEmail(string strSmtpServer, string strFrom, string strFromPass, string strto, string strSubject, string strBody)
{
try
{
SmtpClient client = new SmtpClient(strSmtpServer);
client.Port = 25;
client.UseDefaultCredentials = false;
client.Credentials = new NetworkCredential(strFrom, strFromPass);
client.DeliveryMethod = SmtpDeliveryMethod.Network;
//添加附件
Attachment attachment = null;
string pathFileName = @"F:\工作\问题规总.doc";
attachment = new Attachment(pathFileName );
MailMessage message = new MailMessage(strFrom, strto, strSubject, strBody);
message.Attachments.Add(attachment);
message.BodyEncoding = System.Text.Encoding.UTF8;
message.IsBodyHtml = true;
client.Send(message);
}
catch
{
}
}
protected void SendEmail()
{
try
{
//发送邮件,要记得到邮箱中设置接收SMTP邮件
string strSmtpServer = "mail.vline.net.cn";
string strFrom = "*******@vline.net.cn";
string strFromPass = "123456";
string strto ="*******@vline.net.cn";
string strSubject = "未来科技保证金到期提醒";
//strBody
System.Text.StringBuilder strBody = new System.Text.StringBuilder();
strBody.Append("亲爱的用户,您好:");
strBody.AppendLine("<p/>");
strBody.Append(" 您有即将到期的信息,具体情况见附件,请尽快查看并予以处理!");
strBody.Append(" 该邮件由系统自动发出,请不要回复。");
SendSMTPEmail(strSmtpServer, strFrom, strFromPass, strto, strSubject, strBody.ToString(),);
}
catch ()
{
}
}
//SMTP发送邮件
public static void SendSMTPEmail(string strSmtpServer, string strFrom, string strFromPass, string strto, string strSubject, string strBody)
{
try
{
SmtpClient client = new SmtpClient(strSmtpServer);
client.Port = 25;
client.UseDefaultCredentials = false;
client.Credentials = new NetworkCredential(strFrom, strFromPass);
client.DeliveryMethod = SmtpDeliveryMethod.Network;
//添加附件
Attachment attachment = null;
string pathFileName = @"F:\工作\问题规总.doc";
attachment = new Attachment(pathFileName );
MailMessage message = new MailMessage(strFrom, strto, strSubject, strBody);
message.Attachments.Add(attachment);
message.BodyEncoding = System.Text.Encoding.UTF8;
message.IsBodyHtml = true;
client.Send(message);
}
catch
{
}
}