Search code examples
.netyahoosmtpclient

yahoo disable links when sent from smtpclient .net


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);

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="[email protected]" 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.


Solution

  • 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