?? sends_mail.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 + -