|
How to Build a Mailbot in PHP
Step 1: Building the bot
A couple things to note about building a bot.
- Your bot is going to get called on EVERY email message that is sent to the account.
- 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:
#!/usr/local/sbin/php
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).
<?php
$stdin = fopen('php://stdin', 'r');
?>
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).
<?php
$message_head = array();
$message_body = "";
?>
| Comments: | ||
| How to take online feedbak from user? | Anwarul | 06/10/05 07:24 |
| RE: Message Parsing | Bilal Farooq | 09/24/03 14:14 |
| RE: Mail Parsing - PEAR | montri | 01/25/03 08:57 |
| Mail Parsing - PEAR | Nil Angsioco | 12/09/02 19:52 |
| Mime Parser | Stephen VanDyke | 11/21/02 16:10 |
| Mime Parser | Stephen VanDyke | 11/21/02 16:10 |
| PHP Programming | Mahadi | 11/12/02 09:43 |
| RE: Message Parsing | Michael Galloway | 11/11/02 11:30 |
| Message Parsing | Danny Shepherd | 11/07/02 06:45 |
|
If you are looking for help, please post on the appropriate forum here. Your questions will be answered much more quickly. | ||


