Live data from Hacker News

Free JSON API to instantly check the spam score of your email messages

spamcheck.postmarkapp.com

31–40 of 41 posts

Re: Free JSON API to instantly check the spam score of your email messages

#31
post #23

This is very interesting, but I can't figure out how to use this in Bash, when I try: xargs -I % curl -X POST "http://sa-api.postmarkapp.com/filter \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -v \ -d '{"email":"%", "options":"long"}' \ It seems contents of my email message file are processed one line at a time, instead of the entire message passed in place of % I'm using GNU bash, version…

Please, man xargs if you aren't joking. EDIT: Sorry if that came off harsh.

No, I'm not joking. I guess I'm just really dense. I've also tried passing -L 100 in addition to -I, but the result is the same.

Re: Free JSON API to instantly check the spam score of your email messages

#32
post #31

Earlier quoted context omitted.

Please, man xargs if you aren't joking. EDIT: Sorry if that came off harsh.

No, I'm not joking. I guess I'm just really dense. I've also tried passing -L 100 in addition to -I, but the result is the same.

Why are you using xargs to read to an entire entry? Why not set it as a var and place it in the comment or take it as stdin?

Re: Free JSON API to instantly check the spam score of your email messages

#33
post #31

Earlier quoted context omitted.

No, I'm not joking. I guess I'm just really dense. I've also tried passing -L 100 in addition to -I, but the result is the same.

Why are you using xargs to read to an entire entry? Why not set it as a var and place it in the comment or take it as stdin?

I've also tried this:

   msg=$(cat message)
   curl -X POST "http://sa-api.postmarkapp.com/filter" \
    -H "Accept: application/json" \
    -H "Content-Type: application/json" \
    -v \
    -d '{"email":"'"$msg"'", "options":"long"}'
But sa-api.postmarkapp.com returns "error"... :-(

Re: Free JSON API to instantly check the spam score of your email messages

#34
post #33

Earlier quoted context omitted.

Why are you using xargs to read to an entire entry? Why not set it as a var and place it in the comment or take it as stdin?

I've also tried this: msg=$(cat message) curl -X POST "http://sa-api.postmarkapp.com/filter" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -v \ -d '{"email":"'"$msg"'", "options":"long"}' But sa-api.postmarkapp.com returns "error"... :-(

oh no. I'm sorry! that's the previous url which we moved last minute.

I'm going to go through the doc again to make sure there's nothing else out of place :/

Re: Free JSON API to instantly check the spam score of your email messages

#35
post #33

Earlier quoted context omitted.

I've also tried this: msg=$(cat message) curl -X POST "http://sa-api.postmarkapp.com/filter" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -v \ -d '{"email":"'"$msg"'", "options":"long"}' But sa-api.postmarkapp.com returns "error"... :-(

oh no. I'm sorry! that's the previous url which we moved last minute. I'm going to go through the doc again to make sure there's nothing else out of place :/

I got it from here: http://spamcheck.postmarkapp.com/doc

Re: Free JSON API to instantly check the spam score of your email messages

#36
post #5

Very cool guys, thanks for providing this. Would love to see some stats along with the service over time.

what kind of stats would you be interested in seeing? how often people's tests result in spam vs ham scores? because while I can't see what people are testing, given that it's friday afternoon, I'm betting there's a lot of "asdfasdf" going on :)

I'd be curious of stats via the API as well as stats you guys are processing on postmark as well. Not so much to change my life, but an impressive view into the life of a processing system.

Starting with the type of stats you mentions is great... rates at which the API is being called throughout the day overlapped with rates at which that volume is spam.

I could envision a nice looking bar chart (green) for every hour showing the standard volume bell curve ramping up at 6 am and back down around 4pm and then overlayed on that is another set of bars (red) that show how much of that mail was spam, and how much was (orange) ham or something like that.

Would just give a nice pizzaz to the service and by extension postmark I imagine.

I suppose if you throw what I'm saying into a pot and boil it down, I want you guys to become like Akismet. Every WordPress user knows what it is, everyone uses it and when you find yourself in a non-wordpress environment you reach for the Akismet APIs to help you out anyway.

I figure you guys can popularize postmark via a similar route.

Re: Free JSON API to instantly check the spam score of your email messages

#37
Another tool to use for figuring out spam rules is always helpful. I actually got hit by the Gmail spam filter with my Hacker Newsletter (http://www.hackernewsletter.com) project last week. Checking that specific email in the tool however shows it scored a -0.1. :) So, as with anything... use this resource with care and make sure you do a lot of other testing as well.

Re: Free JSON API to instantly check the spam score of your email messages

#39

Would you consider putting some kind of resource on the site for explaining some of the common results? For example, why the Text to Image ratio matters. Also, I've tried a few emails: 1 of them ranked a 1.0, 2 of them a 0.4, but all three times the little white dot was in the same position (at about 2:50, if it were the face of a clock). Not sure if thats a bug or not.

SpamAssassin score could be in range from -1 (best) to 25 (worst). 0.4 and 1.0 is almost the same, so it's normal for white pointer to stay on the same position.

Oh, no kidding.

Thanks for that update

Re: Free JSON API to instantly check the spam score of your email messages

#40
post #33

Earlier quoted context omitted.

I've also tried this: msg=$(cat message) curl -X POST "http://sa-api.postmarkapp.com/filter" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -v \ -d '{"email":"'"$msg"'", "options":"long"}' But sa-api.postmarkapp.com returns "error"... :-(

oh no. I'm sorry! that's the previous url which we moved last minute. I'm going to go through the doc again to make sure there's nothing else out of place :/

So I see you've updated the doc with a new hostname, but I still get an error, so there's something obviously wrong with my method:

  msg=$(cat message)
  curl -X POST "http://spamcheck.postmarkapp.com/filter" \
    -H "Accept: application/json" \
    -H "Content-Type: application/json" \
    -v \
    -d '{"email":"'"$msg"'", "options":"long"}'

  * About to connect() to spamcheck.postmarkapp.com port 80 (#0)
  *   Trying 184.73.163.218... connected
  * Connected to spamcheck.postmarkapp.com (184.73.163.218) port 80 (#0)
  > POST /filter HTTP/1.1
  > User-Agent: curl/7.21.7 (x86_64-pc-linux-gnu) libcurl/7.21.7 OpenSSL/1.0.0e zlib/1.2.3.4 libidn/1.22 libssh2/1.2.8 librtmp/2.3
  > Host: spamcheck.postmarkapp.com
  > Accept: application/json
  > Content-Type: application/json
  > Content-Length: 5229
  > Expect: 100-continue
  > 
  
Wonder if you've got any pointers on how to do this at the shell...
Post reply on HN