Email发送完全手册
2024-07-21 02:24:35
供稿:网友
1.用asp+发送简单的mail
<% @page language="c#" %>
<% @import namespace="system.web.util" %>
<%
string strto = "[email protected]";
string strfrom = "[email protected]";
string strsubject = "asp发送mail简单例子";
smtpmail.send(strfrom, strto, strsubject,"这仅仅是个简单的文本mail");
response.write("email 已经发送成功");
%>
2.asp+发送html 格式的mail
请注意,这里用了另外的一种发送命令
<% @page language="c#" %>
<% @import namespace="system.web.util" %>
<%
mailmessage msgmail = new mailmessage();
msgmail.to = "[email protected]";
msgmail.cc = "[email protected]";
msgmail.from = "[email protected]";
msgmail.subject = "asp+发送html 格式的mail";
msgmail.bodyformat = mailformat.html;
string strbody = "<html><body><b>hello world</b>" +
" <font color="red">asp+</font></body></html>";
msgmail.body = strbody;
smtpmail.send(msgmail);
response.write("email 已经发送成功");
%>
3.asp+ 发送带有 附件的email
<% @page language="c#" %>
<% @import namespace="system.web.util" %>
<%
mailmessage msgmail = new mailmessage();
msgmail.to = "[email protected]";
msgmail.from = "[email protected]";
msgmail.subject = "attachment test";
msgmail.bodyformat = mailformat.text;
msgmail.body = "check out the attachment!";
msgmail.attachments.add(new mailattachment("c:/temp/doufu.txt"));
smtpmail.send(msgmail);
response.write("email 已经发送成功");
%>
好了,看完这篇文章以后,您是不是对于email发送在asp+中的操作已经没有问题了?哦!还有
问题,没有关系,随时留意本站的更新吧!
本文来源于网页设计爱好者web开发社区http://www.html.org.cn收集整理,欢迎访问。