询问发送邮件 [英] Asking about send mail

查看:123
本文介绍了询问发送邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以知道如何使用c#.net中的无线连接发送邮件吗?

May i know how to send mail using wireless connection in c#.net?

推荐答案

System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage();
           SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");

           mail.From = new MailAddress("Sender email id"); // enter senders email address here
           mail.To.Add("receivers email id");
           mail.Subject = "subject";
           mail.Body = "avc";
         //  Attachment data = new Attachment("D:\\file.bmp");
           //  Attachment data = new Attachment(@"D:\file.pdf");
         //  mail.Attachments.Add(data);
           SmtpServer.Port = 587;
           SmtpServer.Credentials = new System.Net.NetworkCredential("Sender ", "password"); ///// enter email address of the sender nd password of the sender here in parameters
           SmtpServer.EnableSsl = true;

           SmtpServer.Send(mail);



这篇关于询问发送邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆