最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
使用System.Web.Mail通过需验证的邮件服务器发送邮件
时间:2022-07-02 11:33:06 编辑:袖梨 来源:一聚教程网
使用System.Web.Mail通过需验证的邮件服务器发送邮件
使用System.Web.Mail通过需验证的邮件服务器发送邮件,下面是Scott Water在dotText中写的一个发邮件的类,使用起来比较方便,整个类的代码如下:
using System;
using System.Web.Mail;
namespace ZZ
{
///
/// SystemMail 的摘要说明。
///
public class SystemMail
{
private string _adminEmail;
private string _smtpServer = "localhost";
private string _password;
private string _userName;
public SystemMail()
{
}
public string AdminEmail
{
get{return _adminEmail;}
set{_adminEmail = value;}
}
public string SmtpServer
{
get{return _smtpServer;}
set{_smtpServer = value;}
}
public string Password
{
get{return _password;}
set{_password = value;}
}
public string UserName
{
get{return _userName;}
set{_userName = value;}
}
public bool Send(string to, string from, string subject, string message)
{
try
{
MailMessage em = new MailMessage();
em.To = to;
em.From = from;
使用System.Web.Mail通过需验证的邮件服务器发送邮件,下面是Scott Water在dotText中写的一个发邮件的类,使用起来比较方便,整个类的代码如下:
using System;
using System.Web.Mail;
namespace ZZ
{
///
/// SystemMail 的摘要说明。
///
public class SystemMail
{
private string _adminEmail;
private string _smtpServer = "localhost";
private string _password;
private string _userName;
public SystemMail()
{
}
public string AdminEmail
{
get{return _adminEmail;}
set{_adminEmail = value;}
}
public string SmtpServer
{
get{return _smtpServer;}
set{_smtpServer = value;}
}
public string Password
{
get{return _password;}
set{_password = value;}
}
public string UserName
{
get{return _userName;}
set{_userName = value;}
}
public bool Send(string to, string from, string subject, string message)
{
try
{
MailMessage em = new MailMessage();
em.To = to;
em.From = from;
相关文章
- 原神2025最新兑换码有哪些 限时前瞻福利领取 11-16
- 百炼英雄2025兑换码大全 最新礼包福利领取合集 11-16
- 寻道大千2025兑换码 最新可用的礼包码合集 11-16
- 蛋仔派对2025兑换码 最新礼包码合集 11-16
- 元气骑士2025兑换码大全 最新可用礼包码合集 11-16
- 明日方舟终末地测试资格查询入口 官方验证方法一览 11-16