通过Winform发送电子邮件 [英] Sending E-mail through Winform
问题描述
大家好,
我在我的办公室安装了内联网邮件的hmail服务器。我一直在使用Windows live和outlook express来访问客户端计算机上的电子邮件。我打算在c#winforms中构建一个报告应用程序,其中必须创建某些报告,并且应该通过电子邮件发送给所有用户。报告应由任何客户端系统生成和发送。为了mailni的目的我做了以下几点。
MailMessage message = new MailMessage();
SmtpClient smtp = new SmtpClient( 192.168 .0.113, 25 );
message.From = new MailAddress( abc@123.com跨度>);
message.To.Add( new MailAddress( def@123.com跨度>));
message.Subject = 测试;
message.Body = Content;
smtp.EnableSsl = true ;
smtp.UseDefaultCredentials = false ;
smtp.Credentials = new System.Net.NetworkCredential( abc@123.com, 123456);
smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
smtp.Send(message);
域名已被更改.192.168.0.113是smtp host.same在outlook Express和windows live.user凭据中给出的seetings是正确的但应用程序是抛出以下SMTP异常。
System.dll中出现未处理的System.Net.Mail.SmtpException类型异常
其他信息:发送邮件失败。
任何人都可以帮我解决这个问题.. ??
谢谢
检查您的凭据和端口号:由于您使用的是SSL,因此您可能需要不同的端口号,或者该端口被一台PC或其他PC上的防火墙阻止。
如果一切正常,请在没有SSL的情况下再试一次,看看是否有任何区别。
目前,你需要得到信息 - 所以看看任何内部异常 - 我们无法为您获取:我们无法访问您的邮件服务器<!/ BLOCKQUOTE>
Hello All,
i have hmail server installed for intranet mailing in my office. i have been using Windows live and outlook express for acessing emails on client machines. i am planning to build a reporting application in c# winforms in which certain reports has to be created and it should be sent through email for all the users. reports should be generated and sent by any of the client systems. for mailni purpose i ahve done the following.
MailMessage message = new MailMessage(); SmtpClient smtp = new SmtpClient("192.168.0.113",25); message.From = new MailAddress("abc@123.com"); message.To.Add(new MailAddress("def@123.com")); message.Subject = "Test"; message.Body = "Content"; smtp.EnableSsl = true; smtp.UseDefaultCredentials = false; smtp.Credentials = new System.Net.NetworkCredential("abc@123.com", "123456"); smtp.DeliveryMethod = SmtpDeliveryMethod.Network; smtp.Send(message);
domain name has been changed.192.168.0.113 is smtp host.same seetings are given in outlook express and windows live.user credentials are correct but application is throwing the follwing SMTP exception.
An unhandled exception of type 'System.Net.Mail.SmtpException' occurred in System.dll
Additional information: Failure sending mail.
can anyone help me out to resolve this issue..??
thank you解决方案Check your credentials and your port number: since you are using SSL, it's possible that you need a different port number, or that the port is blocked by firewall on one PC or another.
If that all looks right, try again without SSL and see if that makes any difference.
At the moment, you need to get information - so look at any inner exception as well - and we can't get that for you: we don't have access to your mail server!
这篇关于通过Winform发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!