Skip to content

Instantly share code, notes, and snippets.

@adamloving
Last active Dec 13, 2015
Embed
What would you like to do?
Some ruby code to do a spam check of an email via http://spamcheck.postmarkapp.com/doc
#!/usr/bin/env ruby
require 'json'
f = open('test/fixtures/raw_email.txt')
s = f.read
h = { email: s, options: 'long' } # the postmarkapp format
File.open('spam-check.json', 'w') { |f| f.write(h.to_json) }
results = `curl -X POST "http://spamcheck.postmarkapp.com/filter" -H "Accept: application/json" -H "Content-Type: application/json" -v -d @spam-check.json`
results = JSON.parse(results)
puts results['report']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment