Sr. Web Developer
mediabistro.com
US-NY-New York

Justtechjobs.com Post A Job | Post A Resume

How to Build a Mailbot in PHP
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:
#!/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 = "";
?>
[ Next Page ]

[Page 1]  [Page 2]  


Comments:
How to take online feedbak from user?Anwarul06/10/05 07:24
RE: Message ParsingBilal Farooq09/24/03 14:14
RE: Mail Parsing - PEARmontri01/25/03 08:57
Mail Parsing - PEARNil Angsioco12/09/02 19:52
Mime ParserStephen VanDyke11/21/02 16:10
Mime ParserStephen VanDyke11/21/02 16:10
PHP ProgrammingMahadi11/12/02 09:43
RE: Message ParsingMichael Galloway11/11/02 11:30
Message ParsingDanny Shepherd11/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.

Add A Comment:

Name:

Email:

Subject:

Message:

To reduce spam posts, messages are now manually approved

You are not [logged in]. That means your account will not get credit for this post.