how to make a php script that read an email from the server?

前端 未结 2 408
忘掉有多难
忘掉有多难 2021-01-13 05:42

is there any way that when i user send an email to admin@xx.com the php script reads the email\'s information and replay to the user automatically ?

EDIT :: is there

相关标签:
2条回答
  • 2021-01-13 05:50

    Take a look at php's imap extension module. It can access both pop3 and imap accounts.

    If and how you can start a script when an email is delivered to an inbox depends on your local mailing system. E.g. with qmail you can use a command line in .qmail. You might want to ask on ServerFault how this exactly works and how it is configured (and where; afaik .qmail is not the only place where you can add a command line).

    0 讨论(0)
  • 2021-01-13 05:55

    As already suggested, checking an e-mail box (POP3 or IMAP) is a valid way to process e-mail. However, if you're looking for realtime processing, it is indeed possible to have the mail delivered directly to php as standard input.

    You basically tell the mail server to deliver the message to a local script.

    You'll have to delve into CLI PHP, and configure your mail server (which will need to be on the same server as you processing script). So it's not an entirely simple process. But it is possible. I currently run a PHP powered e-mail discussion list using this method.

    I configured my long ago, so I can't recall all the details; but this article should point you in the right direction.

    0 讨论(0)
提交回复
热议问题