How to manage web application by email? Or how to run a PHP script by sending an email?

I want to run a web application in php and mysql using the CakePHP framework. And in order to keep the threshold for using the site in a very low place, I do not want to use a standard login with username / password. (And I don't want my users to be with something like OpenID. Goes to user type.)

So, I think that users will be able to log in by sending an email to login@domain.com without any subject or content. And they will receive in response an email with a link in which their logs will be recorded (it will contain a hash). I will also allow users to do some things without even visiting the site at all, just send an email using the command@domain.com, and the command will be executed. I assume that users and their email providers will take care of their email account security, and as such, my site is not needed.

Now, how do I go from sending an email message with an account that is not read by people to be run from some script there (basically the "dummy client browser" calls the URL (and CakePHP takes care of the rest)?


I have never used cron work before, but I really think I understand their purpose or how they usually work. I cannot call the script of random people visiting the site, as this solution will not work for several reasons. I think I would like to hear more about the possibility of running a script as a response to an incoming message if someone has any data. If it starts as a cron job, it will only check every X minutes, and users will receive a delay in the response (if I understand correctly).

, login @domain.com, , , , .


, , , , , , . , . , , / . , .

+3
10

pop3 php class ( Pear POP3 module).

pop3 :

require ('pop3.php');

$pop3 = new pop3_class();
$pop3->hostname = MAILHOST;
$pop3->Open();
$pop3->Login('myemailaddress@mydomain.com', 'mypassword');

foreach($pop3->ListMessages("","") as $msgidx => $msgsize)
{
    $headers = "";
    $body = "";

    $pop3->RetrieveMessage($msgidx, $headers, $body, -1);
}

POP3, .

cronjob, wget URL- php script.

*/5 * * * * "wget -q --http-user=me --http-passwd=pass 'http://mydomain.com/mail.php'" >> /dev/null 2>&1

Edit

, .

, , ?

, . , , , ( :)).

+7

- CronJob/Timer, . , , script (.. , spamfilter- script "" ) script).

PHP , - script. index.php - , , , "" ", script.

: : . , 4 , 1 ( ) Mail Client, Webmail . Webmail - , , ANOTHER, , Webmail, . OpenID: -)

+3

, . forward Procmail, (php - ), .

+3

OpenID, , . -, . , , . , . , , , 10 . , , , , . , - . , , , . , , , , , , .

+1

, procmail, script. formail, . , /etc/aliases script.

, - , .

+1

. , " " , .

: " , , , - script", procmail a script .

URL. script , , stdin. , script -.

, , , . ".procmailrc"

:

:0 hb:
| /path/to/program

/// - script . script :

#!/usr/bin/php
<?php

$fp=fopen('php://stdin','r');
while($line = fgets($fp)) {
    [do something with each $line of input here]
}

?>

, , , script.

-

+1

. . , , "" , .

. .

, , . /, .

, .

, .

0

, , , , , .

, , , .

0

. .

0

There is a good educational history of thedailywtf.com in software development. The question asked should be resolved by proper design, not techo-woopla.

Alexander, please read the related story and think about gloves, not about an email-oriented web page.

PHP is not a hammer .

0
source

Source: https://habr.com/ru/post/1696703/


All Articles