Using MailMessage and SmtpMail object to realize automatic email transmission [Original]

Source: Internet
Author: User
Tags mailmessage
[Affirm: Must test oneself to see the effect!] :)]
asp+, want to send email, must use the above two objects, which mailmessage with the content of the email set, and SmtpMail will
Email out, the program framework is as follows:
<% @import namespace= "System.web.uit"%>
Dim mail As New MailMessage ' Creates a MailMessage object
mail.to= Recipients
mail.form= Send a person
mail.subject= Theme
mail.bodyformat= format
mail.body= Content
Smtpmail.send (mail)
As the above two categories of objects are included in System.web.util namespace, so <% @import namespace= "System.web.uit"%>
The mark is necessary. Let's take a look at the following source program:
<%@ Import namespace= "System.Web.Util"%>
<Html>
<body bgcolor= "White" >
<form runat= "Server" >
<table border=1>
<Tr><Td> Recipient:</td>
<td><input type= "Text" id= "MailTo" size=40 runat= "Server"/></td></tr>
<Tr><Td> Sender:</td>
<td><input type= "Text" id= "Mailfrom" size=40 runat= "Server"/></td></tr>
<Tr><Td> Theme:</td>
<td><input type= "Text" id= "Mailsubject" size=40 runat= "Server"/></td></tr>
<Tr><Td> content:</td>
<td><textarea id= "Mailbody" rows=8 cols=60 runat= "Server" >
</TextArea>
</Td></Tr>
</Table>
<input type= "button" value= "Send Out" id= "Button1"
onserverclick= "Button1_Click" runat= "Server"/>

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.