我用的vs2008,现在我想把这个页面,比如http://www.123.net/login.aspx通过邮件发出去,在收到的邮箱里显示这个地址的网页(而不只是一个网址),如何做到?
目前我尝试几种办法,没能实现,比如:
<iframe id="I1" frameborder="1" name="I1" src="http://www.123.net/login.aspx" style="width: 700px; height: 150px">
</iframe>
---------------------
在收到的邮箱里,是一片空白,什么都没有?
=======================================
所以请问,如何做到发送网页,在邮箱里能正常显示呢?
目前我尝试几种办法,没能实现,比如:
<iframe id="I1" frameborder="1" name="I1" src="http://www.123.net/login.aspx" style="width: 700px; height: 150px">
</iframe>
---------------------
在收到的邮箱里,是一片空白,什么都没有?
=======================================
所以请问,如何做到发送网页,在邮箱里能正常显示呢?
解决方案 »
- javacript消息框乱码
- pet shop每个项目都有一个.snk的文件是做什么用的?
- 写javascript有什么好的软件吗?
- 如何获取浏览器用户名
- 用session做用户登录判断,但session经常不到时间就退出!
- 小白问题:格式化绑定字符串(马上给分)
- 感谢大家的一贯支持,THINControls新版本出来了。------抵制日货。
- ASP.NET怎样把视屏文件以二进制的方式写入数据库并显示在网页上
- 可不可以(脱机)测试?
- 关于网页界面的数据统计,目前是使用的gridview,但是存在一点问题,想请教大神,求看过来!!!
- URL重写的小问题。。在线等。。
- Access2010的nwind.mdb呢?
做一个静态页拼接在邮箱body中看行不行。没试过。。
何必那么复杂, 你有aspx转静态页面的时间,还不如直接如ls说的做成静态页面. 放在body里面.之后设置邮件的ishtml属性是true就可以了.
=====================
不知有没有好点的办法?
{
int sendInquiry = 0;
int minimum = 0;
int delivery = 0;
int fob = 0;
if (cka.Checked == true) { sendInquiry = 1; }
if (ckb.Checked == true) { minimum = 1; }
if (ckc.Checked == true) { delivery = 1; }
if (ckd.Checked == true) { fob = 1; }
System.Net.Mail.MailMessage msg = new System.Net.Mail.MailMessage();
String addressee = "[email protected]";
String body = "";
string title = subject.Text;
string sendInquiry1 = "";
string Minimum1 = "";
string fob1="";
string delivery1 = "";
string Name=ming.Text+xing.Text;
if (sendInquiry != 1)
{
sendInquiry1 = "否";
}
else {
sendInquiry1 = "是";
}
if (minimum != 1)
{
Minimum1 = "否";
}
else
{
Minimum1 = "是";
}
if (fob != 1)
{
fob1 = "否";
}
else
{
fob1 = "是";
}
if (delivery != 1)
{
delivery1 = "否";
}
else
{
delivery1 = "是";
} //string content = "Co my e-mail address:" + sendInquiry1 + "\r\n" + "subject:" + subject.Text + "\r\n" + "Minimum order quantity:" + Minimum1 + "\r\n" + "FOB Prices(at min.order quantity):" + fob1 + "\r\n" + "Delivery time:" + delivery1 + "\r\n" + "Expected Order Quantity:" + expected.Text + "\r\n" + "Message:" + message.Text + "\r\n" + "Attachment(s):" + attachment.Text + "\r\n" + "Respone Time:" + ddlDays.Text + "\r\n" + "Sex:" + ddlName.Text + "\r\n" + "Name:" + Name + "\r\n" + "Company Name:" + companyName.Text + "\r\n" + "Business E-mail:" + businessEmail.Text;
body += "<style>";
body += "a{ text-decoration:none; color:#444;}";
body += "body{ font-size:12px; font-family:Arial;}";
body += "</style>";
body += "<div style=\"width:807px; float:left;\">";
body += "<div style=\"width:806px; height:114px; float:left;\">";
body += "<div style=\"width:750px; height:30px;\">(*)Required information</div>";
body += "<div style=\"width:750px; height:25px;\"><div style=\"width:170px; float:left;\">To:</div> Dalian Ponytoy Co.,Ltd</div>";
body += "<div style=\"width:750px; height:25px;\"><div style=\"width:170px; float:left;\">Co my e-mail address:</div> [" + sendInquiry1 + "] Send me a copy of each inquiry</div>";
body += "<div style=\"width:750px; height:20px;\"><div style=\"width:170px; float:left;\">Subject</div> [" + subject.Text + "] </div></div>";
body += "<div style=\"width:806px; height:21px; float:left; background-color:#9bb7b4\"><div style=\"width:200px; float:left; color:#FFFFFF;height:21px; text-align:right\">Inquiry Details</div></div>";
body += "<div style=\"width:806px; height:299px; float:left; background-image:url(images/inquiry10.gif);\">";
body += "<div style=\"width:806px; margin-top:20px; height:25px;\">";
body += "<div style=\"width:170px; float:left; height: 15px;\">Select the inforination you </div><div> [" + Minimum1 + "] Minimum order quantity</div></div>";
body += "<div style=\"width:806px; height:56px;\">";
body += "<div style=\"width:170px; height:51px; float:left;\">Want to deceive:</div>";
body += "<div style=\"height: 23px\"> [" + delivery1 + "] FOB Prices(at min.order quantity)</div>";
body += " [" + fob1 + "] Delivery time</div>";
body += "<div style=\"width:806px; height:30px;\">";
body += "<div style=\"width:170px; float:left;\">Expected Order Quantity: </div>";
body += "<div> [" + expected.Text + "] </div>";
body += "</div>";
body += "<div style=\"width:806px; \"><div style=\"width:170px; float:left;\">Message:</div>[" + message.Text + "]</div>";
body += "<div style=\"width:806px; height:30px;\"><div style=\"width:170px; float:left;\">Attachment(s):</div> [" + attachment.Text + "] (only for web url)</div>";
body += "<div style=\"width:806px; height:30px;\"><div style=\"width:170px; float:left;\">Respone Time:</div> Please reply to my inquiry with in [" + ddlDays.Text + "] day(s)</div></div>";
body += "<div style=\"width:806px; height:21px; float:left\"><div style=\"width:806px; height:21px; float:left; background-color:#9bb7b4\"><div style=\"width:200px; float:left; color:#FFFFFF;height:21px; text-align:right\">Contact Details</div></div></div>";
body += "<div style=\"width:806px; height:150px; float:left;\">";
body += "<div style=\"width:806px; height:25px; margin-top:20px;\">";
body += "<div style=\"width:600px; margin-left:100px;\">";
body += "<div style=\"width:130px; float:left;\">Sex:[" + ddlName.Text + "]</div>";
body += "<div style=\"width:130px; float:left;\">Name:[" + Name + "]</div>";
body += "</div>";
body += "</div>";
body += "<div style=\"width:806px; height:25px;\">";
body += "<div style=\"width:600px; margin-left:100px;\">";
body += "<div style=\"width:130px; float:left;\">Company Name:</div>[" + companyName.Text + "]";
body += "</div>";
body += "</div>";
body += "<div style=\"width:806px; height:25px;\">";
body += "<div style=\"width:600px; margin-left:100px;\">";
body += "<div style=\"width:130px; float:left;\">Business E-mail:</div>[" + businessEmail.Text + "]";
body += "</div>";
body += "</div>";
body += "</div>";
body += "</div>";
msg.To.Add(addressee);//收件人
msg.From = new MailAddress("[email protected]", "[email protected]", System.Text.Encoding.UTF8);
/* 上面3个参数分别是发件人地址(可以随便写),发件人姓名,编码*/ msg.Subject = title;//邮件标题
msg.SubjectEncoding = System.Text.Encoding.UTF8;//邮件标题编码
msg.Body = body;//邮件内容
msg.BodyEncoding = System.Text.Encoding.UTF8;//邮件内容编码
msg.IsBodyHtml = false;//是否是HTML邮件
msg.Priority = MailPriority.High;//邮件优先级 SmtpClient client = new SmtpClient();
client.Credentials = new System.Net.NetworkCredential("[email protected]", "ponytoy.cn");
//上述写你的GMail邮箱和密码 client.Port = 22;//Gmail使用的端口
client.Host = "smtp.gmail.com";
client.EnableSsl = true;//经过ssl加密
object userState = msg;
try
{
client.Send(msg);
//简单一点儿可以client.Send(msg);
//Response.Write("发送成功");
}
catch (System.Net.Mail.SmtpException ex)
{
Response.Write(ex.Message);
}
//String strINS = "insert into inquiry (sendInquiry,subject,minimum,delivery,fob,expected,message,attachment,response,sex,nameA,nameB,companyName,businessEmail,AddUserID,DisplayLevel,IsActive)";
//strINS += " values (" + sendInquiry + ",'" + subject.Text + "'," + minimum + "," + delivery + "," + fob + ",'" + expected.Text + "','" + message.Text + "','" + attachment.Text + "','" + ddlDays.Text + "','" + ddlName.Text + "','" + ming.Text + "','" + xing.Text + "','" + companyName.Text + "','" + businessEmail.Text + "','0','0','0')";
Response.Redirect("index.aspx");
}你自己改下吧
body += "a{ text-decoration:none; color:#444;}";
body += "body{ font-size:12px; font-family:Arial;}";
body += "</style>";
body += "<div style=\"width:807px; float:left;\">";=====================================
必须这么做吗?比如我的网页是123.html 不要这么写,直接读取123.html发送,不知是否可以?
aspx类的动态页面,用HttpWebRequest请求返回html内容就行了。
public void Send(string to, string from, string subject, string body, string userName, string password, string smtpHost)
{
MailAddress from = new MailAddress(from);
MailAddress to = new MailAddress(to);
MailMessage message = new MailMessage(from, to);
message.Subject = subject;
message.IsBodyHtml = true;
message.Body = body;
SmtpClient client = new SmtpClient(smtpHost);
client.Credentials = new NetworkCredential(userName, password);
client.Send(message);
}
不知是否真的能?
如果是123.html
string body等于多少呢?
别为是测试所以这里面的内容都是写死了的,你可以做成一个方法,把参数传进去就可以了.
(注释蛮详细的)
public static void SendMailToRegUser()
{
SmtpClient smtp = new SmtpClient(); //实例化一个SmtpClient
smtp.DeliveryMethod = SmtpDeliveryMethod.Network; //邮件的出站方式为 NetWork
smtp.EnableSsl = false;
smtp.Host = "192.168.1.145"; //smtp服务器地址
smtp.Port = 25; //指定smtp服务器端口,默认是25, 如果采用默认端口可以省去这句
//发件人在smtp服务器上的身份凭据, 其实就是发件人的邮箱地址和密码, 就像平时我们发邮件,都要先登录,而这里是自动用发件人的地址,所以也要提供密码
smtp.Credentials = new System.Net.NetworkCredential("[email protected]", "******");
MailMessage mm = new MailMessage(); //实例化一个邮件类
mm.Priority = MailPriority.High; //设置邮件的优先级 //收件方看到的邮件来源,第一个是发信人地址,2为显示的名称, 第三个参数是 第二个参数所使用的编码,如果指定不正确,则对方收到后会显示乱码
//936是简体中文的codepage值,也可以都使用UTF8 或者使用默认
mm.From = new MailAddress("[email protected]", "江江同学", Encoding.GetEncoding(936)); //ReplyTo 表示对方回复邮件时默认的接收地址,即:你用一个邮箱发信,但是用ReplyTo这个邮箱地址来收信
//mm.ReplyTo = new MailAddress("[email protected]", "接收邮箱", Encoding.GetEncoding(936)); //邮件的接收者,支持群发,多个地址之间用 半角逗号 分开 如:mm.To.Add("[email protected],[email protected]"); 也可以用下面的方式一个一个添加
mm.To.Add(new MailAddress("[email protected]", "接收邮箱", Encoding.GetEncoding(936)));
//邮件的抄送者,支持群发,多个邮件地址之间用 半角逗号 分开(密送同抄送相同,mm.Bcc.Add(...))
//mm.CC.Add("[email protected],[email protected],[email protected]");
//也可以一个一个的添加 mm.CC.Add(new MailAddress("[email protected]", "抄送者D", Encoding.GetEncoding(936)));
mm.Subject = "邮件标题!"; //邮件标题
mm.SubjectEncoding = Encoding.GetEncoding(936); //如果你的邮件标题包含中文,这里一定要指定,否则对方收到的极有可能是乱码。
mm.IsBodyHtml = true;
mm.BodyEncoding = Encoding.GetEncoding(936); //同标题一样,如果含中文,指定编码就可以不出现乱码,如果是英文,这句可以不用
mm.Body = "<font color='red'>邮件测试!</font>"; //添加附件,第二个参数,表示附件的文件类型,可以不用指定
//mm.Attachments.Add(new Attachment(@"d:a.doc", System.Net.Mime.MediaTypeNames.Application.Rtf));
//可以添加多个附件
//mm.Attachments.Add(new Attachment(@"d:b.doc")); smtp.Send(mm);
}
现在我想测试一下jmail发送一个网页,msg.getmessagebodyfromurl "http://domain/index.html"
这是否能用?
还有我想message.IsBodyHtml = true;
message.Body = body;
body=(123.html)用数据流读取。
应该是可行的
不需要拼截字符串
其中就包括你所说的<iframe>。
还有<script>都会给过滤掉。
你可以做一个页面。通过连接地址,将用户引回你的网站
除了数据流读取还有别的简单办法吗?
如 p br div h1 、、、、