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收集整理,歡迎訪問。