Click here to Skip to main content
15,890,512 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I am working with 1and1 hosting company and its been a strange issue. I am sending email and passing html script to body. It works fine and html body displayed when i check email on 1and1 webmail account but when i send the same email as cc to some other servers like gmail, hotmail etc, the email goes blank. On furthur investigating i found i can only send plain text to other servers but not html body, html body is only working for 1and1 webmail. I guess some one who has worked with 1and1 can reply to this question.

Thanks in Advance,

Asfand
Posted
Comments
fjdiewornncalwe 29-Nov-10 7:55am    
What exactly is your question? If you can't send html to a recipient, then you have to create a plain text version of the email body to send to them.

1 solution

I hope it will use for u...


public void btnSend_Click(object sender, EventArgs e)
{

MailMessage MyMailMessage = new MailMessage();
MyMailMessage.From = new MailAddress("fromAddress", "Display Name", System.Text.Encoding.UTF8);
MyMailMessage.To.Add("To Address");

MyMailMessage.Subject = "";
MyMailMessage.IsBodyHtml = true;

//MyMailMessage.Body = "<table><tr><td>" + txtName.Text + txtEmail.Text + txtComments.Text + "</table></tr></td>";
MyMailMessage.Body = "";
SmtpClient SMTPServer = new SmtpClient("smtp.gmail.com");
SMTPServer.Port = 587;
//SMTPServer.Credentials = new System.Net.NetworkCredential("appuisgoodboy@gmail.com", System.Configuration.ConfigurationSettings.AppSettings["pwd"].ToString());
SMTPServer.Credentials = new System.Net.NetworkCredential("abc@gmail.com", "abc123");
SMTPServer.EnableSsl = true;
try
{
SMTPServer.Send(MyMailMessage);
Response.Redirect("Thankyou.aspx");
}
catch (Exception ex)
{

}
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900