Chilkat HOME .NET Core C# Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi ActiveX Delphi DLL Go Java Lianja Mono C# Node.js Objective-C PHP ActiveX PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 2 Swift 3,4,5... Tcl Unicode C Unicode C++ VB.NET VBScript Visual Basic 6.0 Visual FoxPro Xojo Plugin
(DataFlex) Get SpamAssassin Score for an EmailUses Postmark’s spam API (a RESTfull interface to the SpamAssassin filter tool) to analyze an email to get a spam score.
Use ChilkatAx-win32.pkg Procedure Test Boolean iSuccess Handle hoEmail Variant vJson Handle hoJson Handle hoHttp Variant vResp Handle hoResp String sTemp1 Integer iTemp1 Boolean bTemp1 // This example requires the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. // First build an email to check. Get Create (RefClass(cComChilkatEmail)) To hoEmail If (Not(IsComObjectCreated(hoEmail))) Begin Send CreateComObject of hoEmail End Set ComSubject Of hoEmail To "this is a test" Set ComFrom Of hoEmail To "support@chilkatsoft.com" Get ComAddTo Of hoEmail "John Doe" "john@example.com" To iSuccess Get ComAddPlainTextAlternativeBody Of hoEmail "this is a test" To iSuccess Get ComAddHtmlAlternativeBody Of hoEmail "<html><body><b>Hello John!</b><p>This is a test</p></body></html>" To iSuccess Get ComAddFileAttachment2 Of hoEmail "qa_data/jpg/starfish.jpg" "image/jpeg" To iSuccess // Check this email by implementing this curl command: // curl -X POST "https://spamcheck.postmarkapp.com/filter" // -H "Accept: application/json" // -H "Content-Type: application/json" // -v // -d '{"email":"raw dump of email", "options":"short"}' Get Create (RefClass(cComChilkatJsonObject)) To hoJson If (Not(IsComObjectCreated(hoJson))) Begin Send CreateComObject of hoJson End Get ComGetMime Of hoEmail To sTemp1 Get ComUpdateString Of hoJson "email" sTemp1 To iSuccess Get ComUpdateString Of hoJson "options" "short" To iSuccess Get Create (RefClass(cComChilkatHttp)) To hoHttp If (Not(IsComObjectCreated(hoHttp))) Begin Send CreateComObject of hoHttp End Get pvComObject of hoJson to vJson Get ComPostJson3 Of hoHttp "https://spamcheck.postmarkapp.com/filter" "application/json" vJson To vResp If (IsComObject(vResp)) Begin Get Create (RefClass(cComChilkatHttpResponse)) To hoResp Set pvComObject Of hoResp To vResp End Get ComLastMethodSuccess Of hoHttp To bTemp1 If (bTemp1 <> True) Begin Get ComLastErrorText Of hoHttp To sTemp1 Showln sTemp1 Procedure_Return End Get ComStatusCode Of hoResp To iTemp1 Showln "response status code = " iTemp1 Showln "response body: " Get ComBodyStr Of hoResp To sTemp1 Showln sTemp1 Send Destroy of hoResp End_Procedure |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.