PHPBuilder - How to build a mailbot in PHP Page 2

RSS Twitter

How to build a mailbot in PHP - Page 2

by: Michael Galloway
November 6, 2002

Step 1: Building the bot

A couple things to note about building a bot.
  1. Your bot is going to get called on EVERY email message that is sent to the account.
  2. Your bot MUST avoid "Returned Mail" loops.
First thing we need to do is set up your file to execute from the system as a script. You do this just as you would a PERL program. Place the shebang on the first line:
Next you need to open your stdin (php 4.3 makes the $stdin variable a global one so you do not need to fopen. However I'm running 4.2.1, so I do).

Setup your initial variables. You do not need to create these, but I find that my needs might change for the mailbot so having them available (should I require body parsing, other header information, etc. I don't have to rewrite anything).

= array();
$message_body "";

« Previous Page
Next Page »

Comment and Contribute

Your comment has been submitted and is pending approval.

Michael Galloway



(Maximum characters: 1200). You have characters left.