aspNetEmail

EmailMessage.GetBodyFromURL Method 

Retrieve the text from any valid URL.

public bool GetBodyFromURL(
   string url
);

Parameters

url
Any Valid URL.

Return Value

Remarks

When using this method, also set ContentTransferEncoding=MailEncoding.QuotedPrintable. This will provide the ender user with a more email friendly web page.

This method does not save the binary data of a web page, only the html text. This is equivalent to viewing the source of a web page. Because some web pages actually display different data depending upon the browser type, the text may vary than when you view the source in your browser. This is beyond the control of the component.

Example

[C#]
            EmailMessage msg = new EmailMessage("Mail1.MyCompany.com");
            msg.FromAddress = "me@MyCompany.com";
            msg.AddTo( "you@YourCompany.com", "Billy Bob" );
            msg.Subject = "Here is a copy of our website";
            msg.UrlContentBase = "http://MyCompany.com";
            //make the web pages mail friendly
            msg.ContentTransferEncoding = MailEncoding.QuotedPrintable;
            msg.BodyFormat = MailFormat.Html;
            msg.GetBodyFromURL( "http://www.MyCompany.com" );
            if ( msg.Send() )
            {
            	Console.WriteLine( "Message Sent!");
            }
            else
            {
            	Console.WriteLine( msg.LastException().Message );
            }
            
[Visual Basic]
            Dim msg As New EmailMessage("Mail1.MyCompany.com")
            msg.FromAddress = "me@MyCompany.com"
            msg.AddTo("you@YourCompany.com", "Billy Bob")
            msg.Subject = "Here is a copy of our website"
            msg.UrlContentBase = "http://www.MyCompany.com"
            'make the web page, email friendly
            msg.ContentTransferEncoding = MailEncoding.QuotedPrintable
            msg.BodyFormat = MailFormat.Html
            msg.GetBodyFromURL("http://www.MyCompany.com")
            If (msg.Send()) Then
                Console.WriteLine("Message Sent!")
            Else
                Console.WriteLine(msg.LastException().Message)
            End If
            

See Also

EmailMessage Class | aspNetEmail Namespace