Asp.net电子邮件 [英] Asp.net email

查看:119
本文介绍了Asp.net电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我正在与1and1托管公司合作,这是一个奇怪的问题.我正在发送电子邮件并将html脚本传递到正文.当我在1and1 Webmail帐户上检查电子邮件时,它可以正常工作并显示html正文,但是当我将与cc相同的电子邮件发送到gmail,hotmail等其他服务器时,电子邮件将变为空白.在进一步调查中,我发现我只能将纯文本发送到其他服务器,而不能发送html正文,html正文仅适用于1and1网络邮件.我猜有些曾经与1and1一起工作过的人可以回答这个问题.

在此先感谢,

Asfand

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

推荐答案

我希望它将用于...


公共无效btnSend_Click(对象发送者,EventArgs e)
{

MailMessage MyMailMessage = new MailMessage();
MyMailMessage.From = new MailAddress("fromAddress",显示名称",System.Text.Encoding.UTF8);
MyMailMessage.To.Add(收件人地址");

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

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

}
}
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)
{

}
}


这篇关于Asp.net电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆