Sample code for 30+ languages & platforms
VB.NET Requires Chilkat v11.0.0+

Request a SpamAssassin score for a sample email

See more Email Object Examples

Submit a synthetic message to Postmark’s SpamCheck endpoint. The service receives the complete MIME you provide. Request a short result and check both the HTTP status and the API success field before reading the numeric score. SpamCheck API documentation.

Chilkat VB.NET Downloads

VB.NET
Dim success As Boolean = False

'  Assumes Chilkat is unlocked. See Global Unlock Sample.

Dim email As New Chilkat.Email
email.From = "Workshop team <events@example.com>"
success = email.AddTo("Alex Rivera","alex@example.net")
If (success <> True) Then
    Debug.WriteLine(email.LastErrorText)
    Exit Sub
End If

email.Subject = "Workshop registration"
email.Body = "Your workshop registration is confirmed."
Dim request As New Chilkat.JsonObject
request.UpdateString("email",email.GetMime())
request.UpdateString("options","short")
Dim http As New Chilkat.Http
http.RequireSslCertVerify = True
Dim resp As New Chilkat.HttpResponse
success = http.HttpJson("POST","https://spamcheck.postmarkapp.com/filter",request,"application/json",resp)
If ((success <> True) Or (resp.StatusCode <> 200)) Then
    Debug.WriteLine("SpamCheck request failed. HTTP " & resp.StatusCode)
    Exit Sub
End If

Dim result As New Chilkat.JsonObject
success = result.Load(resp.BodyStr)
If (success <> True) Then
    Debug.WriteLine(result.LastErrorText)
    Exit Sub
End If

If (result.BoolOf("success") <> True) Then
    Debug.WriteLine(result.StringOf("message"))
    Exit Sub
End If

Debug.WriteLine("SpamAssassin score: " & result.StringOf("score"))