Is it possible to send out an email from PHP mail, then reply to the message, and have the text from the reply message imported into the php script as a variable? If that is not posssible, how would I be able to send an e开发者_StackOverflowmail to my server to run a script based off the text in the body of my email?
You have two choices:
You could have the mail server run the script when it receives an email. How you do this depends on what mail server you use.
Run a script/program periodically (using a
cron
job or equivalent) to fetch mail from the server (usingpop3
or equivalent) and process each email as necessary.
The details depend a lot on exactly what you're trying to do and what platform you are running on.
Not directly. PHP does not actually send the mail unless you're using a library that has implemented the smtp protocol. There are libraries like phpMailer and pear:mail that do this, but typically people use the mail() call which dumps the mail off to an installed MTA like sendmail or postfix to do the actual work. Furthermore, the replied to mail has to be received by a valid mail server. In other words: php is not an mta.
It is certainly possible to set the mail server up to support POP or IMAP and use a PHP library to fetch the messages using those protocols.
精彩评论