How do I automate e-mail delivery?
<% @import namespace= "System.web.uit"%>
Dim mail As New MailMessage
' Establish a mailmessage object Mail.to= recipient
Mail.form= sender
Mail.subject= theme
Mail.bodyformat= format
Mail.body= content
smtpmail.send (mail)
The specific code is as follows:
<%@ Import namespace= "System.Web.Util"%>
<title> Thousands of flowers flying email send </title>
<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 " id= "Button1" onserverclick= "Button1_Click" runat= "Server"/>
</form>
<asp : Label id= "Label1" runat= "Server"/>
</body>
<script language= "VB" runat= "server
sub button1_click (sender as Object, e as EventArgs)
dim mail as MailMessage = New mailmessage
mail. to= mailto.value
mail. from= mailfrom.value
mail. subject= mailsubject.value
mail.bodyformat=mail.format.text
mail.body= Mailbody. Value
' read the form's mailto , and so on, and specify the to attribute to the Mail object, respectively .
Smtpmail.send (mail)
' call smtpmail send .
Label1.Text = " Congratulations , send mail successfully !"
End Sub
</script>
[1]