Hi all,
If you have a email server on Linux server, you can pipe email to a backend script easily.
This allows you to parse email or control server in email.
Take an example for PHP
echo 'test: "php -q |/your/script.php"' >> /etc/aliases
This command will need php cli support, in Ubuntu, enter
sudo apt-get install php5-cli
And then create a file called script.php start with #!
-
#!/usr/bin/php
-
<?php
-
// read in email from stdin
-
$fd = fopen("php://stdin", "r");
-
$email = "";
-
while (!feof($fd)) {
-
$email .= fread($fd, 1024);
-
}
-
fclose($fd);
The email content will be in $email, you can do whatever you like
If you are thinking of email command, add a line like
-
exec ($email);
If you are thinking of calling Drush without managing drupal init externally, you can
-
exec ("drush your-custom-command " .$email);
Of coz, it needs certain privilege.
Enjoy ~
Keith