With ASP.net implementation of this article recommended to the friend function

Source: Internet
Author: User
Tags mail mailmessage
asp.net///< summary>
< author> flying Eagle @aspcool.com

< description> This article with the ASP.net implementation of this article recommended to the friend's function.
< copyright>asp Cool technology Information Network (www.ASPCool.com)
</summary>

Here the eagle uses a simple example to show you how to use the ASP.net mail delivery function. First, let's do a send interface first. Tuijian.asp, where title is the title of the article, and the ID represents the number of the article.

< html>
< body>
Hello, welcome to use the ASP Cool technology Information Network article recommendation function, you recommend the article is: "<%=request (" title ")%>" .< br>
< form action= "mail.aspx" >
Your mailbox:< INPUT type= "text" name= "sender" >

Recipient mailbox:< INPUT type= "text" name= "Accepter" >

< INPUT type= "hidden" name= "title" Value= "<%=request (" title ")%>" >
< INPUT type= "hidden" name= id "value=" <%=request ("id")%> ">
< input type= "submit" value= "send" >< INPUT type= "reset" value= "rewrite" >
</form>
</body>

Below we use ASP.net to implement the recommended article function, mail.aspx

<% @Page language= "C #" debug= "true"%>
<% @Import namespace= "System.Web.Mail"%>
<%


MailMessage msgmail = new MailMessage ();

msgmail.to = request["Accepter"]; Mail Recipient
msgmail.cc = "webmaster@aspcool.com";
Msgmail.from = request["Sender"];
Msgmail.subject = "Your friend has recommended an article to you from aspcool.com." ";

Msgmail.bodyformat = mailformat.html;
String strbody = "< html>< body>< b>" + request["Accepter"] + "Hello. < br> "+
"Your friend: < font color=\" red\ ">" + request["sender"]+ "from < a href=http://www.aspcool.com>asp cool technology information network to recommend an article to you-- < a href=http://www.aspcool.com/lanmu/dot.asp?id= "+request[" ID "]+ request[" title "+". please
Msgmail.body = strbody;

Smtpmail.send (Msgmail);

Response.Write ("Hello, your letter of recommendation has been sent out, thank you for the Cool Technology Information Network support");
%>

See, is not very simple, if you have to support asp.net space, you can easily recommend your site.



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.