Send in ASP.NET mail: Send the entire page to the other party mailbox

xiaoxiao2021-03-06  93

?

We generally have previously received emails, the content of the message is the entire page. How did this do it? Today I saw an article on 9CBS, I want to realize the content of the DataGrid control to the other party email, I think the easiest way is to send this DataGrid control page content directly to the other party mailbox. (I used to The speed sent when the test is still very fast) The following is the code I used to write: imports system.web.mail? Private function httpcontent (Byval URL AS STRING) AS STRING ??????? Dim Objrequest AS WebRequest = System .NET.HTTPWEBREQUEST.CREATE (URL) ?????? Dim SR AS New StreamReader (). GetResponseSstream (), System.Text.Encoding.default ??????? Dim Result As String = sr.readToend () ??????? sr.close () ??????? Return Result ??? End Function ??? Private Sub Page_load (ByVal Sender As System.Object, ByVal E AS System.Eventargs) Handles mybase.load ??????? 'Use the user code to place the initialization page here ??? End Sub

??????????. Byval e as system.EventArgs Handles button1.click ??????? dim mailobj as new mailmessage ??????? Mailobj.Subject = "South Power Grid .NET Forum "??????? Mailobj.From = TextBox2.text 'Sender Email ??????? Mailobj.to = TextBox1.text' Received ?????? Mailobj.Priority = Mailpriority.high ??????? Mailobj.Body = httpcontent ("http://www.flycatch.com") ??????? Mailobj.fields.add ("http://schemas.microsoft .com / cdo / configuration / smtpauthenticate "," 1 ") 'Basic Authentication ??????? Mailobj.fields.add (" http://schemas.microsoft.com/cdo/configuration/sendusername ", 121432147 @ QQ.com) 'Set your username here ??????? Mailobj.fields.add ("http://schemas.microsoft.com/cDo/configuration/sendpassword", "*****")' set Your Password Here

??????? mailobj.bodyformat = mailformat.html ??????? SMTPMAIL.SMTPSERVER = "server address" ??????? SMTPMAIL.SEND (Mailobj) ??????? Response .Write.

转载请注明原文地址:https://www.9cbs.com/read-122099.html

New Post(0)