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
(PowerBuilder) 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.
integer li_rc integer li_Success oleobject loo_Email oleobject loo_Json oleobject loo_Http oleobject loo_Resp // This example requires the Chilkat API to have been previously unlocked. // See Global Unlock Sample for sample code. // First build an email to check. loo_Email = create oleobject // Use "Chilkat_9_5_0.Email" for versions of Chilkat < 10.0.0 li_rc = loo_Email.ConnectToNewObject("Chilkat.Email") if li_rc < 0 then destroy loo_Email MessageBox("Error","Connecting to COM object failed") return end if loo_Email.Subject = "this is a test" loo_Email.From = "support@chilkatsoft.com" loo_Email.AddTo("John Doe","john@example.com") loo_Email.AddPlainTextAlternativeBody("this is a test") loo_Email.AddHtmlAlternativeBody("<html><body><b>Hello John!</b><p>This is a test</p></body></html>") li_Success = loo_Email.AddFileAttachment2("qa_data/jpg/starfish.jpg","image/jpeg") // 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"}' loo_Json = create oleobject // Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0 li_rc = loo_Json.ConnectToNewObject("Chilkat.JsonObject") loo_Json.UpdateString("email",loo_Email.GetMime()) loo_Json.UpdateString("options","short") loo_Http = create oleobject // Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0 li_rc = loo_Http.ConnectToNewObject("Chilkat.Http") loo_Resp = loo_Http.PostJson3("https://spamcheck.postmarkapp.com/filter","application/json",loo_Json) if loo_Http.LastMethodSuccess <> 1 then Write-Debug loo_Http.LastErrorText destroy loo_Email destroy loo_Json destroy loo_Http return end if Write-Debug "response status code = " + string(loo_Resp.StatusCode) Write-Debug "response body: " Write-Debug loo_Resp.BodyStr destroy loo_Resp destroy loo_Email destroy loo_Json destroy loo_Http |
© 2000-2024 Chilkat Software, Inc. All Rights Reserved.