Step 2: Installing the bot
Installing your mailbot is a platform dependent issue, so you may need to review the process your mail delivery software goes through. In our setup, which is pretty standard for most *NIX platforms, we start with a .forward file.
Create a file called .forward (if one does not already exist) in your home directory for the user account you want the mailbot to reside in. You may want to consider making a new user account (i.e. mailbot) as SPAM or other mail will get filtered through your mailbot if it is an account that is used for regular mail purposes. In the .forward file place the line:
“|/path/to/bot/mailbot.php”
You want to include the quotes, but change /path/to/bot/ to be the absolute path (do not use ~/) to your mailbot program.
Next you may need to indicate to the Sendmail Restricted Shell (smrsh) that the mailbot program is a valid program to send mail too. An easy way to do this is to add a link in the smrsh directory to your mailbot program. So:
cd /etc/smrsh/ ln -s /path/to/bot/mailbot.php
This will create the necessary link to allow your mailbot to be usable in the .forward file. An indication of when this is needed is when you receive returned email (when you attempt to mail your mailbot program), that indicates a 5.0.0 error.
At this point, your mailbot is up and running! Things to consider are issues of error reporting, and performance. It is generally a good idea to have many areas where your script will terminate if it runs in to problems, or encounters an email that it does not need to answer. A general rule of thumb is: Do NOT try and answer every email that the bot reads. This could easily lead to loops, especially on invalid return email addresses. Good luck, and enjoy!
–Michael