|
|
| ||||||||||||||
![]() |

Business Automation - Meet your Employee of the Month
Mike Peters, 07-25-2007If you don't understand why Business Automation is so important, go read The E-Myth first, then come back to this post.
--
Ok, great. So you know why Business Automation can make or break your business.
Are you finding yourself constantly sending repetitive emails to your key employees?
Here are some examples of what I mean -
* "Chris, we need to refund yesterday's order by Roger Frankel. He changed his mind"
* "Jane, please login to ClickBank and send me a list of the top 5 products right now"
* "Ben, how did we do with sales yesterday compared to last week?"
* "Kim, what's the situation with the customer support back log?"
Sounds familiar?
What if you had a single employee you could always email questions and instructions to and get stuff done right away, 24 hours a day?
Meet your new Employee of the Month -- sendmail script automation.
How does it work?
You send an email to robot@yourdomain.com, asking any one of a predefined sets of questions or instructions. Anything like "send sales summary", "refund mike@softwareprojects.com" or "suspend ppc campaigns".
Your robot understands the instruction, executes it right away and emails you back a summary of what was done.
This is very simple to implement and could help you cut cost, save time and streamline your business.
How to Implement
The first thing we have to do is tell our email system to send all emails to robot@yourdomain.com to our script.
Open up your email virtusertable (typically under /etc/virtusertable) and define this alias:
Now go to the directory where you'd like robot.php to run, open up a new file named robot.php and paste this code:
We now have a script that will get executed whenever sending an email to robot@yourdomain.com. The script will parse all headers of the email message, storing the subject of the message (where you will be giving the robot script instructions) into a local variable.
Now all you have to do is write handler functions to handle every single one of your frequent questions.
In an effort of keeping this article short, here's how you would add handling for a "what time is it" question:
In Summary
Business Automation is a very powerful tool.
Ask your engineer to implement an email robot and teach it how to address the most frequent questions and instructions.
Please use the comments section to let me know which other common tasks you find yourself handling in your business, or contact me directly if you'd like the code.
--
Ok, great. So you know why Business Automation can make or break your business.
Are you finding yourself constantly sending repetitive emails to your key employees?
Here are some examples of what I mean -
* "Chris, we need to refund yesterday's order by Roger Frankel. He changed his mind"
* "Jane, please login to ClickBank and send me a list of the top 5 products right now"
* "Ben, how did we do with sales yesterday compared to last week?"
* "Kim, what's the situation with the customer support back log?"
Sounds familiar?
What if you had a single employee you could always email questions and instructions to and get stuff done right away, 24 hours a day?
Meet your new Employee of the Month -- sendmail script automation.
How does it work?
You send an email to robot@yourdomain.com, asking any one of a predefined sets of questions or instructions. Anything like "send sales summary", "refund mike@softwareprojects.com" or "suspend ppc campaigns".
Your robot understands the instruction, executes it right away and emails you back a summary of what was done.
This is very simple to implement and could help you cut cost, save time and streamline your business.
How to Implement
The first thing we have to do is tell our email system to send all emails to robot@yourdomain.com to our script.
Open up your email virtusertable (typically under /etc/virtusertable) and define this alias:
robot: "|/home/robot.php"
Replace /home/robot.php with the full path where you're going to place the robot script. Now go to the directory where you'd like robot.php to run, open up a new file named robot.php and paste this code:
<?php #!/usr/bin/php
// read from stdin
$fd = fopen("php://stdin", "r");
$email = "";
while (!feof($fd)) {
$email .= fread($fd, 4096);
}
fclose($fd);
// handle email
$lines = explode("n", $email);
// empty vars
$from = "";
$subject = "";
$headers = "";
$message = "";
$splittingheaders = true;
for ($i=0; $i < count($lines); $i++) {
if ($splittingheaders) {
// this is a header
$headers .= $lines[$i]."n";
// look out for special headers
if (preg_match("/^Subject: (.*)/", $lines[$i], $matches)) {
$subject = $matches[1];
}
if (preg_match("/^From: (.*)/", $lines[$i], $matches)) {
$from = $matches[1];
}
} else {
// not a header, but message
$message .= $lines[$i]."n";
}
if (trim($lines[$i])=="") {
// empty line, header section has ended
$splittingheaders = false;
}
}
?>
Now all you have to do is write handler functions to handle every single one of your frequent questions.
In an effort of keeping this article short, here's how you would add handling for a "what time is it" question:
<?php if (Strcasecmp($subject,"what time is it")==0)
{
$answer = strftime("It is now %H:%M, %d-%m-%Y");
}
// Email response back
if (!empty($answer))
{
mail($from, "RE: $subject", $answer, "From: ");
}
?>
Business Automation is a very powerful tool.
Ask your engineer to implement an email robot and teach it how to address the most frequent questions and instructions.
Please use the comments section to let me know which other common tasks you find yourself handling in your business, or contact me directly if you'd like the code.
Subscribe Now to receive new posts via Email as soon as they come out.
Post your comments
About us | Contact us | Privacy | Terms & Conditions | Affiliates
Thursday, August 21st, 2008 Page generated in 0.344 seconds | ![]() |
