Last active
December 13, 2015 23:09
-
-
Save adamloving/4989653 to your computer and use it in GitHub Desktop.
Some ruby code to do a spam check of an email via http://spamcheck.postmarkapp.com/doc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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