Quite a few people have reported issues with submitting solutions to the Facebook Puzzle Master. I hated the idea of installing and configuring a MUA to make things work, so I wrote a bash script. This should work on any Unix/Linux server with Postfix or Sendmail that is otherwise capable of sending Internet E-mail.
So far I have not been using any compiled languages. The script will have to be edited to be able to send compressed submissions with a Makefile etc.
The script should be in the same directory as your executable file and you should have a folder named “.archived-submissions” to hold your sent items, or edit the script accordingly. Then just call $ ./submit.sh <keyword> e.g. $ ./submit.sh meepmeep
You must edit line 2 (FROMADDRESS) to hold the address linked to your Facebook account (Google Mail, Yahoo!, university accounts, etc.) and line3 (SENDERADDRESS) to hold an address regularly used for sending on your server (to make sure you make it around any spam filters). Both lines may be set to the same address, but this didn’t seem to work in my case with Facebook linked to my Google Mail address.
#!/bin/bash FROMADDRESS="email@example.com" SENDERADDRESS="yourotheraddress" SUBMITTO="firstname.lastname@example.org" NOW=`date +%Y-%m-%d-%H-%M-%S` BOUNDARY=_`date | md5sum | cut -d\ -f1`_ MSGFILENAME=.archived-submissions/$NOW-$1.msg cat > $MSGFILENAME <<TFNAB-27-End-of-File Content-Type: multipart/mixed; boundary="_001$BOUNDARY" Sender: $SENDERADDRESS From: $FROMADDRESS To: $SUBMITTO Subject: $1 Date: `date -R` MIME-Version: 1.0 --_001$BOUNDARY Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable This text should be ignored by the robot --_001$BOUNDARY Content-Type: application/octet-stream Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="$1" `base64 $1` --_001$BOUNDARY-- TFNAB-27-End-of-File /usr/sbin/sendmail -f $SENDERADDRESS $SUBMITTO < $MSGFILENAME
Note: it seems that using the address linked to your account is only of interest if you want to use the Facebook Puzzles App to post your successful submissions to your profile.
Tags: bash, email, Facebook Puzzles
Comments feed for this article
Trackback link: https://ten-fingers-and-a-brain.com/2011/01/facebook-puzzles-submissions/trackback/