Author |
|
KC Guest Group
Joined: 10 November 2003
Online Status: Online Posts: 262
|
Posted: 25 September 2005 at 11:30pm | IP Logged
|
|
|
I was trying to import a HTML page from some website using the ImportBodyText method but to no avail, the message body simply appeared blank. I have no such problem with HTML pages on local disk though.
Is there any other method that I can use to do this?
|
Back to Top |
|
|
Alex AfterLogic Support
Joined: 19 November 2003
Online Status: Offline Posts: 2206
|
Posted: 26 September 2005 at 9:44am | IP Logged
|
|
|
ImportBodyText method supports importing local HTML files only. To import a web page into the message body, you can use standard XMLHTTP object.
Code:
Dim objXMLHTTP, pageURL, objSMTP
pageURL = "http://www.afterlogic.com"
Set objXMLHTTP = CreateObject("MSXML2.XMLHTTP")
Set objSMTP = CreateObject("MailBee.SMTP")
objSMTP.LicenseKey = "Put your license key here"
objSMTP.ServerName = "mail.server.com"
' If your SMTP server requires authentication, please uncomment these lines
' objSMTP.UserName = "UserName"
' objSMTP.Password = "Password"
' objSMTP.AuthMethod = 2
objSMTP.FromAddr = "from@domain1.com"
objSMTP.ToAddr = "to@domain2.com"
objSMTP.Subject = "Web page"
objXMLHTTP.Open "GET", pageURL, False
objXMLHTTP.Send
If objXMLHTTP.Status = 200 Then
objSMTP.BodyFormat = 1
objSMTP.BodyText = objXMLHTTP.ResponseText
If objSMTP.Send Then
MsgBox "Sent successfully"
objSMTP.Disconnect
Else
MsgBox "Error #" & objSMTP.ErrCode
End If
Else
MsgBox objXMLHTTP.Status & " " & objXMLHTTP.StatusText
End If
Set objXMLHTTP = Nothing
Set objSMTP = Nothing
|
|
|
Please note objXMLHTTP.Send method will throw an exception if the specified URL doesn't exist or network error occurs.
Regards,
Alex
|
Back to Top |
|
|