' Copyright (c) 2021 ActivePDF, Inc. ' ActivePDF Server 2013 ' Example generated 04/11/21 Dim FSO, strPath, results ' Get current path Set FSO = CreateObject("Scripting.FileSystemObject") strPath = FSO.GetFile(Wscript.ScriptFullName).ParentFolder & "\" Set FSO = Nothing ' Instantiate Object Set oSVR = CreateObject("APServer.Object") ' Add an email oSVR.AddEMail ' Set server information oSVR.SetSMTPInfo "0.0.0.0", 25 oSVR.SetSMTPCredentials "john.doe", "activePDF", "asdfasdf" ' Set email addresses oSVR.SetSenderInfo "John Doe", "john.doe@asdidlwenra.com" oSVR.SetReplyToInfo "John Doe", "john.doe@asdidlwenra.com" oSVR.SetRecipientInfo "Jane Doe", "jane.doe@asdidlwenra.com" oSVR.AddToCC "Jim Doe", "jim.doe@asdidlwenra.com" oSVR.AddToBcc "Janice Doe", "janice.doe@asdidlwenra.com" ' Subject and Body oSVR.EMailSubject = "PDF Delivery from activePDF" oSVR.SetEMailBody "<html><body style='background-color: #EEE; padding: 4px;'>Here is your PDF!</body></html>", true ' Attachments - Binary attachments can be added with AddEMailBinaryAttachment oSVR.AddEMailAttachment strPath & "x.pdf" ' Other email options oSVR.EMailReadReceipt = false oSVR.EMailAttachOutput = true ' Convert the PostScript file into PDF Set results = oSVR.ConvertPSToPDF(strPath & "PS.ps", strPath & "email.pdf") If results.ServerStatus <> 0 Then ErrorHandler "ConvertPSToPDF", results, results.ServerStatus End If ' If running multiple conversions in one instance: ' One email can be removed before the next conversion oSVR.RemoveEMail "john.doe@activepdf.com" ' An attachment can be removed oSVR.ClearEMailAttachments ' or all emails can be removed oSVR.ClearEMails ' Release Object Set oSVR = Nothing ' Process Complete Wscript.Echo("Done!") ' Error Handling Sub ErrorHandler(method, oResult, errorStatus) Wscript.Echo("Error with " & method & ": " & vbcrlf _ & errorStatus & vbcrlf _ & oResult.details) Wscript.Quit 1 End Sub