Hey All,

Evans been working hard getting SMS working for identi.ca. I've just set 
it up
on my server too - here's how I did it. This is not designed to be a 
how-to but
instead a guide for competent developers/admins who want to play too.

Assumptions:
     You have a mobile on one of the carriers that supports email to sms.
     You can setup a wildcard email address for your domain.
     You like playing with bleeding edge stuff and are ready to debug 
issues.
     You can change stuff on your server - this isn't going to be going 
onto your
       shared server.
     Your mail server is setup to use .forward files (I have 
postfix/procmail).

Prequisites:
     Pear Mail_mimeDecode
         Do a *pear list* and see if Mail and Mail_mimeDecode is there. 
If not then
         *pear install Mail Mail_mimeDecode* them.

     PHP mailparse extension
         Do a *php -m* in a shell and check mailparse is there. If not
         *pecl install mailparse* to install it and then *php -m* again 
to check
         it's there. I had to edit my php.ini to get it to load the 
extension.
         Once installed, restart apache to make sure it's still good.

Get the latest code:
     Pull the latest code from darcs. If you wanted really bleeding edge 
(my code
       that hasn't been tested by Evan yet) then
       *darcs pull http://dev2.gardyneholt.co.nz/laconic* too.
     Update your .htaccess file from the sample (I always for get to do 
this)
     If you've got a renamed .ini file in classes then make sure you 
copy over
       your one with stoica.ini

Update your database:
     Easy way is to dump the database data, without create tables in 
there. Drop
       all the tables (or create a new empty database). Import 
db/laconica.sql.
       Import your data again into the empty tables that now have all 
the extra
       columns.
     Also import carrier.sql which populates the sms_carrier table with 
all the
       carriers.

Edit your config.php:
     Add a section similar to this (if you pulled from me, it's in the 
sample):
         #Email info, used for SMS send
         $config['mail']['notifyfrom'] = '[EMAIL PROTECTED]';
         $config['mail']['domain'] = 'microblog.example.net';
         # See 
http://pear.php.net/manual/en/package.mail.mail.factory.php for options
         $config['mail']['backend'] = 'smtp';
         $config['mail']['params'] = array(
                                     'host' => 'localhost',
                                     'port' => 25,
                                     );

     $config['mail']['notifyfrom'] is the address that is used as the 
sender for
       the initial "here's you code" messages.
     $config['mail']['domain'] is the domain name that the random email 
addresses
       are at. A bit more on this later.
     $config['mail']['backend'] and $config['mail']['params'] are for 
setting how
       emails will be sent. See the PEAR docs for options here.

Test so far:
     Login, add your mobile and see if it works. At this point it did 
for me. If
       not then watch your mail server logs and see if the email sends 
and that
       it has the correct from and to addresses etc.
     Create an incoming email address and ensure it's at the correct domain.

Email server config:
     Now you need to get incoming email for anything at 
microblog.example.net to
       be passed to a php script, maildaemon.php.
     How you do this will vary depending on your mail setup and how much 
control
       you have. I setup a wildcard/catch all address using my normal 
hosting
       control panel for [EMAIL PROTECTED] I then went into 
the home
       directory for this user and added a .forward file for postfix to 
read.
     In the .forward file is (all on one line):
         "|IFS=' ' && exec /usr/local/bin/php 
/home/gardyneholt/gh/mikenz/www/laconica/maildaemon.php || exit 75 
#www-data"
     This takes every email and forwards it to the php script.

Test email:
     So to test all this, for a start just send an email to
       [EMAIL PROTECTED] and ensure it doesn't bounce. 
Then look at
       the mail server logs and see if it was sent to the script. eg:
       Jul 22 ....  status=sent (delivered to command: IFS=' ' && exec ...
     Then send an email to your incoming email address and see that the 
message
       shows up and a dent on your server.

Test the whole thing:
     Subscribe to another user (that you can post from) and enable sms
       notification in you sms settings. Log out and log in with the 
other user
       and send a message. This should get sent to your mobile.
     Now reply to the SMS message on your mobile and this should (does 
with mine
       anyway) get forwarded back to the sender which will be your incoming
       address. This reply should show up in your messages.


All done - Congrats if you made it :-) This was written from memory and 
there may be things missing. Let me know how far you get and if there's 
anything I can assist with.

Thanks Evan for all the great for and effort you put into identi.ca and 
laconica, it's awesome.

Have fun

- MikeNZ
_______________________________________________
Laconica-dev mailing list
[email protected]
http://mail.laconi.ca/mailman/listinfo/laconica-dev

Reply via email to