Windows应用程序中通过gmail使用csharp发送电子邮

Windows应用程序中通过gmail使用csharp发送电子邮

本文介绍了在Windows应用程序中通过gmail使用csharp发送电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试了很多事情,但无法从我的应用程序发送d邮件.

请为我提供相同的指导....

i tried many thing but not able to send d mail from my application.

Kindly guide me for d same....

try
                {
                    System.Net.Mail.MailMessage msg = new System.Net.Mail.MailMessage();

                  msg.To.Add("[email protected]");
                  msg.Subject = "Something";
msg.Body = " mail test" + DateTime.Today.ToString();
                    msg.IsBodyHtml = false;



SmtpClient SMPclint = new SmtpClient();

                    SMPclint.Host = "smtp.gmail.com";


                    SMPclint.EnableSsl = true;


                     NetworkCredential NetCry = new NetworkCredential();
                    NetCry.UserName = "[email protected]";
                    NetCry.Password = "myPasswd";
                    SMPclint.UseDefaultCredentials = true;
                    SMPclint.Credentials = NetCry;



                    SMPclint.Port = 587;


                    SMPclint.Send(msg);


                }
                catch
                {
                    MessageBox.Show("error");
                }

但是d代码会产生错误,也可能会导致我无法使用邮件发送邮件.


在此先感谢

Praveen


but d code is giving error as well as i m not abe to send the mail by using the same.


Thanks in Advance

Praveen


i m Doing Software Engi.(GNIIT).. I Lov 2 Do Programming...n i Want be a HacKer..

推荐答案

感谢您的发帖!我建议将您的问题发布到一个MS论坛中,


Visual C#开发人员中心 > Visual C#论坛 > Visual C#General

位于此处:

Thank you for your post!  I would suggest posting your question in one of the MS Forum,


Visual C# Developer Center > Visual C# Forums > Visual C# General

located here:  http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/threads

祝您度过愉快的一天!


这篇关于在Windows应用程序中通过gmail使用csharp发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-24 02:04