![]() |
Chilkat HOME Android™ AutoIt C C# C++ Chilkat2-Python CkPython Classic ASP DataFlex Delphi DLL Go Java Node.js Objective-C PHP Extension Perl PowerBuilder PowerShell PureBasic Ruby SQL Server Swift 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. Note: This example requires Chilkat v11.0.0 or greater.
integer li_rc integer li_Success oleobject loo_Email oleobject loo_Json oleobject loo_Http oleobject loo_Resp li_Success = 0 // 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 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 li_rc = loo_Json.ConnectToNewObject("Chilkat.JsonObject") loo_Json.UpdateString("email",loo_Email.GetMime()) loo_Json.UpdateString("options","short") loo_Http = create oleobject li_rc = loo_Http.ConnectToNewObject("Chilkat.Http") loo_Resp = create oleobject li_rc = loo_Resp.ConnectToNewObject("Chilkat.HttpResponse") li_Success = loo_Http.HttpJson("POST","https://spamcheck.postmarkapp.com/filter",loo_Json,"application/json",loo_Resp) if li_Success = 0 then Write-Debug loo_Http.LastErrorText destroy loo_Email destroy loo_Json destroy loo_Http destroy loo_Resp return end if Write-Debug "response status code = " + string(loo_Resp.StatusCode) Write-Debug "response body: " Write-Debug loo_Resp.BodyStr destroy loo_Email destroy loo_Json destroy loo_Http destroy loo_Resp |
© 2000-2025 Chilkat Software, Inc. All Rights Reserved.