How do I send a web page?
Use namespace System.IO and System.NET VB.NET ’In Page_Load Dim mailcontenturl As String = ‘http://www.syncfusion.com’ Dim mail As New MailMessage() mail.To = ‘[email protected]’ mail.From = ‘[email protected]’ mail.Subject = ‘Test.’ ’To send webpage mail.Body = GetHTML(mailcontenturl) mail.BodyFormat = MailFormat.Html mail.UrlContentBase = mailcontenturl SmtpMail.SmtpServer = ‘localhost’ SmtpMail.Send(mail) ’Function GetHTML Private Function GetHTML(url As String) As String Dim wReq As WebRequest = System.Net.HttpWebRequest.Create(url) Dim sr As New StreamReader(wReq.GetResponse().GetResponseStream()) Dim result As String = sr.ReadToEnd() sr.Close() Return result End Function ’GetHTML C# //In Page_Load string mailcontenturl =’http://www.syncfusion.com’; MailMessage mail = new MailMessage(); mail.To = ‘[email protected]’; mail.From = ‘[email protected]’; mail.Subject = ‘Test.’; //To send webpage mail.Body = GetHTML ( mailcontenturl ); mail.BodyFormat = MailFormat.Html; mail.UrlContentBase = mailcontenturl; SmtpMail.SmtpServer = ‘localhost’; SmtpMail.Send( mail ); //Function GetHTML private string GetHTML( string url ) { WebRequest wReq= System.Net.HttpWebRequest.Create(url); StreamReader sr = new StreamReader( wReq.GetResponse().GetResponseStream() ); string result = sr.ReadToEnd(); sr.Close(); return result; }
How to send HTML mail in ASP.NET
VB.NET Dim mail As New MailMessage() mail.To = ‘[email protected]’ mail.From = ‘[email protected]’ mail.Subject = ‘Test.’ mail.BodyFormat = MailFormat.Html mail.Body = ‘Test Message’ SmtpMail.SmtpServer = ‘localhost’ ’your real server goes here SmtpMail.Send(mail) C# MailMessage mail = new MailMessage(); mail.To = ‘[email protected]’; mail.From = ‘[email protected]’; mail.Subject = ‘Test.’; mail.BodyFormat = MailFormat.Html; mail.Body = ‘Test Message’; SmtpMail.SmtpServer = ‘localhost’; //your real server goes here SmtpMail.Send( mail );
How to send simple text mail in ASP.NET
VB.NET Dim mail As New MailMessage() mail.To = ‘[email protected]’ mail.From = ‘[email protected]’ mail.Subject = ‘Test.’ mail.Body = ‘Test Message’ SmtpMail.SmtpServer = ‘localhost’ ’your real server goes here SmtpMail.Send(mail) C# MailMessage mail = new MailMessage(); mail.To = ‘[email protected]’; mail.From = ‘[email protected]’; mail.Subject = ‘Test.’; mail.Body = ‘Test Message’; SmtpMail.SmtpServer = ‘localhost’; //your real server goes here SmtpMail.Send( mail );
How do I add the Reply-To header to the MailMessage
VB.NET mail.Headers.Add( ‘Reply-To’, ‘[email protected]’ ) C# mail.Headers.Add( ‘Reply-To’, ‘[email protected]’ );
How to set the vertical align of a TableCell programmatically
VB.NET Dim tbl As New TableCell() ’VerticalAlign is enumeration in System.Web.UI.WebControls namespace tbl.VerticalAlign = VerticalAlign.Top C# TableCell tbl=new TableCell(); //VerticalAlign is enumeration in System.Web.UI.WebControls namespace tbl.VerticalAlign = VerticalAlign.Top;