Class/Email.cs
(开头部分) 5KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Text;
using System.Net.Mail;
using System.Collections;
using System.Windows.Forms;
using System.Net;
using System.Configuration;
// 下载于www.51aspx.com
namespace Ericbai
{
public class TestEmail
{
#region 发送Email邮件
public string smtp;
public string from;
public string pwd;
public string to;
public string subject;
public string body;
public ArrayList paths_fujian;
public TestEmail(string Pto, string Psubject, string Pbody, ArrayList Ppaths)
{
string getText = System.Configuration.ConfigurationManager.ConnectionStrings["ercDon"].ConnectionString;
string uname = getText.Substring(0, getText.IndexOf("="));
string upwd = getText.Substring(getText.IndexOf("=") + 1);
smtp = "smtp.163.com";
from = uname;
pwd = upwd;
to = Pto;
subject = Psubject;
body = Pbody;
paths_fujian = Ppaths;
}
/*发邮件*/
public bool SendMail()
{
//创建smtpclient对象
System.Net.Mail.SmtpClient client = new SmtpClient();
client.Host = smtp;
client.UseDefaultCredentials = true;
client.Credentials = new System.Net.NetworkCredential(from, pwd);
client.DeliveryMethod = SmtpDeliveryMethod.Network;
//创建mailMessage对象
System.Net.Mail.MailMessage message = new MailMessage(from, to);
message.Subject = subject;
//正文默认格式为html
message.Body = body;
message.IsBodyHtml = true;
message.BodyEncoding = System.Text.Encoding.UTF8;
//添加附件
if (paths_fujian.Count != 0)
{
foreach (string path in paths_fujian)
{
Attachment data = new Attachment(path, System.Net.Mime.MediaTypeNames.Application.Octet);
后面还有 83 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。