在C#.NET中发送电子邮件 [英] Sending an email in C# .net
问题描述
我有以下的code发送电子邮件:
I have the following code to send an email:
System.Net.Mail.SmtpClient client = new System.Net.Mail.SmtpClient();
client.Send(myfrom@email.com, "myreceipient@email.com", "test", "test");
现在,因为我从我自己的工作电脑发送的话,我有IIS 5.0的设置,显然在收件人侧大多数电子邮件服务器将承担这可能是垃圾邮件从ADSL的IP它的到来。所以,我验证上面使用code:
Now because I'm sending it from my own work PC, I have IIS 5.0 setup and obviously most email servers on the recipients side will assume this could be spam as its coming from a ADSL IP. So I authenticate the code above using:
client.Credentials = new System.Net.NetworkCredential(myEmailHere, myPasswordHere);
但它仍然不会发送给某些客户端。有没有解决的办法吗?最终,这个code将坐在一个Rackspace公司的服务器上,怎么能/我将它设置为确保收件人的服务器不认为它的垃圾邮件?
But it still won't send to some clients. Is there a way around this? Eventually this code will sit on a RackSpace server, how could/would I set it up to make sure the recipient servers do not think its spam?
推荐答案
而你的电子邮件不会被标记为垃圾邮件是一个庞大而具有挑战性的课题。
Having your email not flagged as spam is a huge and challenging topic.
第一,最好的规则是:
- 从一个静态的IP地址发送的,没有一个环节一个回收池(比如从DSL /电缆供应商,虚拟服务器主机等)。检查是否在previous所有者通过发送测试邮件到您的测试帐户在Hotmail,雅虎,Gmail等用它为垃圾邮件。
- 切勿从该地址发送垃圾邮件(包括任何多几个人会标记为垃圾邮件,即使你认为它不是)
如果你认真发送显著量合法的电子邮件,并没有得到标记为垃圾邮件,你有很多东西需要学习超越你可以因此获得。这里有一些资源,让你开始沿着这条道路:
If you're serious about sending a significant amount of legitimate email and not getting flagged as spam, you have a lot to learn beyond what you can get from SO. Here are a few resources to get you started down that path:
这篇关于在C#.NET中发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!