学习笔记,发QQ邮件

首先设置自己的邮箱  设置   账号

吧这些全部选中就可以了

POP3/IMAP/SMTP/Exchange/CardDAV/CalDAV服务

学习笔记,发QQ邮件_第1张图片

学习笔记,发QQ邮件_第2张图片

 

public static void Sender()
        {
            try
            {

                SmtpClient client = new SmtpClient();
                client.Host = "smtp.qq.com";
                MailMessage mm = new MailMessage();
                client.Port = 25;

                mm.From = new MailAddress("[email protected]");
                mm.To.Add(new MailAddress("[email protected]"));
                mm.Subject = "Hello~!";
                mm.Body = "hahahahaa ";
                mm.IsBodyHtml = false;
                mm.Priority = MailPriority.High;

                client.Credentials = new NetworkCredential("[email protected]", "*******");
                client.Send(mm);


            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

        }


 

 

你可能感兴趣的:(学习笔记)