⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sends_mail.cs

📁 Help Desk Pro has three different interfaces for all three domains of users, providing them with the
💻 CS
字号:
using System;
using System.Web.Mail;

namespace Final_Project_Alpha
{
	/// <summary>
	/// Summary description for sends_mail.
	/// </summary>
	public class sends_mail
	{
		public sends_mail()
		{
			//
			// TODO: Add constructor logic here
			//
		}

		public void send_mail(String to,String from,String subject,String body)
		{
			MailMessage MM=new MailMessage();
			
			MM.To=to;
			MM.From=from;
			MM.Subject=subject;
			MM.Body=body;
			//MM.Attachments=attach.Text;
			
			try
			{
				SmtpMail.SmtpServer="202.83.173.53";
				SmtpMail.Send(MM);
			}
			catch(Exception ex)
			{
				Console.Write( ex.Message ) ;
			}

		}

		
		public void send_mail_att(String to,String from,String subject,String body,String att)
		{
			MailMessage MM=new MailMessage();
			if(att == "")

			{
				MM.To=to;
				MM.From=from;
				MM.Subject=subject;
				MM.Body=body;
			}
		
			else
			{

				MM.To=to;
				MM.From=from;
				MM.Subject=subject;
				MM.Body=body;

				MailAttachment MyAttachment = new MailAttachment(@att);
				MM.Attachments.Add(MyAttachment);


			}

			
			try
			{
				SmtpMail.SmtpServer="202.83.173.53";
				SmtpMail.Send(MM);
			}
			catch(Exception ex)
			{
				Console.Write( ex.Message ) ;
			}

		}




	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -