Procházet zdrojové kódy

删除 'Mail.cs'

master
童毓泽 před 3 roky
rodič
revize
8a4ebca8ab
1 změnil soubory, kde provedl 0 přidání a 59 odebrání
  1. +0
    -59
      Mail.cs

+ 0
- 59
Mail.cs Zobrazit soubor

@ -1,59 +0,0 @@
using System;
using System.Collections.Generic;
using System.Web;
using System.Net.Mail;
/// <summary>
/// 发送邮件
/// </summary>
namespace Basic.Tools
{
public class Mail
{
/// <summary>
/// 发送邮件(smtp服务器/发送邮箱/邮箱密码/接收邮箱/发件人名称/邮件标题/邮件内容)
/// </summary>
/// <param name="_Host"></param>
/// <param name="_from"></param>
/// <param name="_pwd"></param>
/// <param name="_tomail"></param>
/// <param name="_senderDisplayName"></param>
/// <param name="_Subject"></param>
/// <param name="_Body"></param>
/// <returns></returns>
public static bool Send(string _Host, string _from, string _pwd, string _tomail, string _senderName, string _Subject, string _Body)
{
bool Result = false;
try
{
//创建smtpclient对象
System.Net.Mail.SmtpClient client = new SmtpClient();
client.Host = _Host;//163的smtp服务器是 smtp.163.com
client.UseDefaultCredentials = false;
client.Credentials = new System.Net.NetworkCredential(_from, _pwd);
client.DeliveryMethod = SmtpDeliveryMethod.Network;
System.Text.Encoding encoding = System.Text.Encoding.UTF8;
MailAddress mailfrom = new MailAddress(_from, _senderName, encoding);//发件人邮箱地址,名称,编码UTF8
MailAddress mailto = new MailAddress(_tomail, "A", encoding);//收件人邮箱地址,名称,编码UTF8
//创建mailMessage对象
System.Net.Mail.MailMessage message = new MailMessage(mailfrom, mailto);
message.Subject = _Subject;
//正文默认格式为html
message.Body = _Body;
message.IsBodyHtml = true;
message.BodyEncoding = encoding;
message.SubjectEncoding = encoding;
//message.HeadersEncoding = encoding;
client.Send(message);
Result = true;
}
catch (Exception ex)
{
string e = ex.Message.ToString();
Result = false;
}
return Result;
}
}
}

Načítá se…
Zrušit
Uložit