asp+發(fā)送Email完全手冊(cè)
發(fā)表時(shí)間:2023-08-08 來源:明輝站整理相關(guān)軟件相關(guān)文章人氣:
[摘要]/*豆腐制作,都是精品http://www.asp888.net 豆腐技術(shù)站如轉(zhuǎn)載 請(qǐng)注明出處*/asp+發(fā)送Email 完全手冊(cè),本文包含我們發(fā)送Mail的所有常見的例子,當(dāng)然,限于篇幅,我們只是...
/*
豆腐制作,都是精品
http://www.asp888.net 豆腐技術(shù)站
如轉(zhuǎn)載 請(qǐng)注明出處
*/
asp+發(fā)送Email 完全手冊(cè),本文包含我們發(fā)送Mail的所有常見的例子,當(dāng)然,限于篇幅,我們只是
簡(jiǎn)單的舉例子,如果大家有什么意見的話,歡迎到 http://www.asp888.net/bbs 討論
1.用asp+發(fā)送簡(jiǎn)單的Mail
<% @Page Language="C#" %>
<% @Import Namespace="System.Web.Util" %>
<%
string strTo = "asp888@asp888.net";
string strFrom = "webmaster@asp888.net";
string strSubject = "asp發(fā)送mail簡(jiǎn)單例子";
SmtpMail.Send(strFrom, strTo, strSubject,"這僅僅是個(gè)簡(jiǎn)單的文本mail");
Response.Write("Email 已經(jīng)發(fā)送成功");
%>
2.asp+發(fā)送HTML 格式的mail
請(qǐng)注意,這里用了另外的一種發(fā)送命令
<% @Page Language="C#" %>
<% @Import Namespace="System.Web.Util" %>
<%
MailMessage msgMail = new MailMessage();
msgMail.To = "asp888@asp888.net";
msgMail.Cc = "doufu@asp888.net";
msgMail.From = "webmaster@asp888.net";
msgMail.Subject = "asp+發(fā)送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 已經(jīng)發(fā)送成功");
%>
3.asp+ 發(fā)送帶有 附件的Email
<% @Page Language="C#" %>
<% @Import Namespace="System.Web.Util" %>
<%
MailMessage msgMail = new MailMessage();
msgMail.To = "asp888@asp888.net";
msgMail.From = "webmaster@asp888.net";
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 已經(jīng)發(fā)送成功");
%>
好了,看完這篇文章以后,您是不是對(duì)于Email發(fā)送在asp+中的操作已經(jīng)沒有問題了?哦!還有
問題,沒有關(guān)系,隨時(shí)留意本站的更新吧