Tutorials to .com


ASP.NET Development Articles


Can't Find What You're Looking For?

Tutorials to .com » Dotnet » Development » asp + Send Email full manual

asp + Send Email full manual

Print View , by: iSee ,Total views: 11 ,Word Count: 465 ,Date: Sat, 22 Aug 2009 Time: 4:06 PM

/ *
Bean production, are products
technical points such as tofu http://www.asp888.net reprint please specify the source
* /
asp + Send Email fully manual, this article contains all the mail send us examples of common, of course, space is limited, we are just simple examples, if you have any views, Welcome to http://www.asp888.net/ bbs discussion
1. Using a simple asp + Send Mail
<% @ Page Language = "C #"%>
<% @ Import Namespace = "System.Web.Util"%>
<%
string strTo = "asp888@asp888.net";
string strFrom = "webmaster@asp888.net";
string strSubject = "asp send mail simple example";

SmtpMail.Send (strFrom, strTo, strSubject, "This is just a simple text mail");
Response.Write ( "Email has been sent successfully");
%>
2.asp + send HTML-formatted mail
Please note that here the use of a send command
<% @ 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 + send HTML-formatted 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 has been sent successfully");
%>
3.asp + Send Email with attachments
<% @ 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 has been sent successfully");
%>

Well, after reading this article, you is not for the Email to send in the asp + the operation has no problem? Oh! There are problems, there is no relation between the update site at any time pay attention to it!

Author: tofu ()


Google
 

Rating: Not yet rated

Comments

No comments posted.