WebArchiveX.SMTPMailer - ArchiveAndSend Method
Builds MHT web archive and sends it by email.
The method is especially useful if you need to email HTML file and all its
resources (such as images or style sheets). The MHT web archive file can be attached or embedded into the
body of the outgoing mail message.
IMPORTANT: Before calling this method
please make sure that all of the SMTP Server properties are correctly set.
C++ Syntax
Show Syntax
HRESULT ArchiveAndSend(
BSTR bstrHtmlFile,
BSTR bstrMhtFile,
BOOL bIsAttachment
);
Parameters
- bstrHtmlFilePath
- [in] BSTR - path to the input HTML file.
-
- bstrMhtFile
- [in] BSTR - output MHT file.
bIsAttachment
[in] BOOL - Is the MHT file created will be attached to the outgoing mail message.
Return value
Returns S_OK if successful, or an error value otherwise.
Script Syntax
Show Syntax
Boolean ArchiveAndSend(
String htmlFilePath,
String bstrMhtFile,
Boolean bIsAttachment
);
Parameters
- bstrHtmlFilePath
- [in] String - path to the input HTML file.
-
- bstrMhtFile
- [in] String - output MHT file.
- bIsAttachment
- [in] Boolean - Is the MHT file created will be attached to the outgoing mail message.
ASP Sample: VB Script (without error handling)
<%@ Language=VBScript%>
<%
Set oWAMailer = Server.CreateObject("WebArchiveX.SMTPMailer")
oWAMailer.oWABuilder.SetCharset "windows-1255"
oWAMailer.sMAILServer = "MySMTPServerIP"
oWAMailer.sSMTPUser = "MyServerUserName"
oWAMailer.sSMTPPass = "MyServerPassword"
oWAMailer.sMailSubject = "WebArchiveX MHT file"
oWAMailer.sSenderEmail = "info@csystems.co.il"
oWAMailer.sSenderName = "WebArchiveX Robot"
oWAMailer.sMailRecipients = "test@csystems.co.il"
oWAMailer.ArchiveAndSend "C:\inetpub\wwwroot\test\test.html", "C:\inetpub\wwwroot\test\test.mht", True
%>
JavaScript (with error handling)
try
{
var oWAMailer = new ActiveXObject("WebArchiveX.SMTPMailer");
oWAMailer.oWABuilder.SetCharset("windows-1255");
oWAMailer.sMAILServer = 'MySMTPServerIP';
oWAMailer.sSMTPUser = 'MyServerUserName';
oWAMailer.sSMTPPass = 'MyServerPassword';
oWAMailer.sMailSubject = 'WebArchiveX MHT file';
oWAMailer.sSenderEmail = 'info@csystems.co.il;'
oWAMailer.sSenderName = 'WebArchiveX Robot';
oWAMailer.sMailRecipients = 'test@csystems.co.il';
oWAMailer.ArchiveAndSend('c:\\inetput\\wwwroot\\sample.htm', 'c:\\inetput\\wwwroot\\sample.mht',true);
}
catch(e)
{
alert('ERROR: ' + e.description);
}
-
WebArchiveX
API - WebArchiveX Website
- C Systems Website -
C Systems - Creative software solutions since 1996. All rights reserved. Terms of use.