Asp.net电子邮件

编程入门 行业动态 更新时间:2024-10-22 23:10:50
本文介绍了Asp电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

你好, 我正在与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"); SMTPServer.Port = 587; //SMTPServer.Credentials =新的System.Net.NetworkCredential("appuisgoodboy@gmail",System.Configuration.ConfigurationSettings.AppSettings ["pwd"].ToString()); SMTPServer.Credentials =新的System.Net.NetworkCredential("abc@gmail","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"); SMTPServer.Port = 587; //SMTPServer.Credentials = new System.Net.NetworkCredential("appuisgoodboy@gmail", System.Configuration.ConfigurationSettings.AppSettings["pwd"].ToString()); SMTPServer.Credentials = new System.Net.NetworkCredential("abc@gmail", "abc123"); SMTPServer.EnableSsl = true; try { SMTPServer.Send(MyMailMessage); Response.Redirect("Thankyou.aspx"); } catch (Exception ex) { } }

更多推荐

Asp.net电子邮件

本文发布于:2023-11-16 09:52:43,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1603213.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:电子邮件   Asp   net

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!