从smtpclient .NET发送时,雅虎禁用链接 [英] yahoo disable links when sent from smtpclient .net
问题描述
我建立一个Web应用程序发送电子邮件抛出 SmtpClient
在.NET中的应用程序工作正常,成功发送到Gmail账户和Hotmail帐户的电子邮件,但是当我发送邮件到雅虎帐户它成功交付,但我把邮件中的链接是由雅虎禁用。雅虎在某种程度上改写的联系,完全删除的href属性,我不知道该怎么办,我已经想尽格式,我知道,但它是没有好处的。
这里是我用来发送邮件的code。
I'm building a web application that sends emails throw SmtpClient
in .net the application is working fine, emails sent successfully to gmail accounts and hotmail accounts, however when I sent emails to yahoo account it delivered successfully, but the links I put in the message is disabled by yahoo. yahoo somehow rewrites the links and totally remove the "href" property, I dunno what to do, I've tried every format i know but it was no good.
here is the code that I use to send messages.
objEmail = new System.Net.Mail.MailMessage();
objEmail.To.Add(new MailAddress(contact.Value.ToString(),null));
objEmail.From = new MailAddress(from, null);
objEmail.Subject = subject;
objEmail.Body = Body;
objEmail.IsBodyHtml = true;
SmtpClient client = new SmtpClient();
client.Send(objEmail);
和这里是在web.config文件中的smtpclient定义
and here is the definition of the smtpclient in the web.config file
<system.net>
<mailSettings>
<smtp deliveryMethod="Network">
<network enableSsl="true" host="smtp.gmail.com" password="password" userName="user@gmail.com" port="587"/>
</smtp>
</mailSettings>
</system.net>
在邮件正文中,我把这样一个简单的链接,
in the message body I put a simple link like that,
<a href="http://www.postagi.com/HomePage.aspx?id=101">tester</a>
这里是雅虎展现在那里的电子邮件收件箱。
here is what yahoo show in there email inbox.
<a id="yui_3_2_0_1_1327400481004292" rel="nofollow">tester</a>
这个错误真的要把我逼疯了,请大家帮忙。
this error really drives me crazy, please help.
推荐答案
我只是解决了它...看来,我必须写的完整链接'的http://我不知道为什么只有雅虎需要这个格式。这是工作的罚款与Gmail和Hotmail,但最后我很高兴,我能解决这个问题。
I just solved it... it seems that i must write the complete link with the 'http://' I dunno why only yahoo needs this format. it was working fine with gmail and hotmail, but in the end I'm glad that I was able to solve it
这篇关于从smtpclient .NET发送时,雅虎禁用链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!