smtpclient 邮件发送测试

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Mail;
using System.Net;

namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{

//1
SmtpClient sc = new SmtpClient("smtp.qq.com");
sc.Credentials = new NetworkCredential("[email protected]", "*******");
sc.Send("[email protected]", "[email protected]", "hello", "ceshi");

 

//2

MailMessage my = new MailMessage( "[email protected]", "[email protected]");
my.Subject = "hello";
my.Body = "ceshi";
my.Priority = MailPriority.High;

SmtpClient sc = new SmtpClient("smtp.qq.com");
sc.Credentials = new NetworkCredential("[email protected]", "wzds139625");
sc.Send(my);

 


}
}
}

你可能感兴趣的:(client)