Question

string from = "abc@gmail.com";     chaîne à = "xyz @ gmail.com, @ xyz yahoo.co.in";     mot de passe chaîne = "abcxyz";

MailMessage mail = new System.Net.Mail.MailMessage();
mail.To.Add(to);
mail.From = new MailAddress(from, "Check Email", System.Text.Encoding.UTF8);
mail.Subject = "This is a test mail";
mail.SubjectEncoding = System.Text.Encoding.UTF8;
mail.Body = "<html><body><h1>My Message</h1><br><a href=www.stackoverflow.com>stackoverflow</a></body></html>";
mail.IsBodyHtml = true;

SmtpClient client = new SmtpClient();
client.Credentials = new System.Net.NetworkCredential(from,password);
client.Port = 587;
client.Host = "smtp.gmail.com";
client.EnableSsl = true; 
client.Send(mail);

Ce code SENTS avec succès le courrier. Quand je regarde mon gmail, le lien « Stackoverflow » rend comme lien et j'ai pu accéder à la page correspondante, mais dans Yahoo je ne trouve aucun lien plutôt que le texte « stackoverflow » apparaît.

Était-ce utile?

La solution

<a href="http://www.stackoverflow.com">stackoverflow</a>

Vous avez oublié le http://

Autres conseils

Peut-être Yahoo! Mail est moins indulgent sur les valeurs non cotées d'attributs HTML, essayez ceci:

mail.Body 
    = "<html><body><h1>My Message</h1><br><a href=\"http://www.stackoverflow.com\">stackoverflow</a></body></html>";

Essayez

<a href="http://www.stackoverflow.com/"> stackoverflow</a>

Essayez spécifiant un HTML valide:

mail.Body = "<html><body><h1>My Message</h1><br><a href=\"http://www.stackoverflow.com\">stackoverflow</a></body></html>";

Lors de l'envoi en vrac de contenu html comme corps, http n'importe. Voici le code dans mon fichier de config me troublait. Quand j'ajouté http, il fonctionne très bien, sans http, Yahoo échoue.

<tr>
  <td colspan="2"  onClick="#stackoverflow#" style="cursor:hand;">
    <center>
     <b>
       <a href='http://www.stackoverflow.com' style="color:#1C0693;text-decoration:none;">stackoverflow</a>
     </b>
    </center>
 </td>
</tr>
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top