Re: Update site through email

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

on 06/29/2006 06:10 PM Adam Zey said the following:
>>> Hy guys I'd like to know if there is a way to update a site through
>>> sending an email. Something like this, you send an email and the body
>>> of the email substitutes a text you use in your site. Igreat apreciate
>>> any help since I couldn't find anything on this topic.
>>
>> Sure, you can send a message attaching the files you want to update in
>> your site to an address with a POP3 mailbox and then use a POP3 client
>> to retrieve and parse the message to extract the files to be updated.
>>
>> You may want to try this POP3 client class that you can use for that
>> purpose.
>>
>> It provides a cool feature that lets you retrieve messages from POP3
>> mailbox using PHP fopen or file_get_contents functions like this:
>>
>> file_get_contents('pop3://user:password@xxxxxxxxxxxxxxxxx/1');
>>
>> http://www.phpclasses.org/pop3class
>>
>> You can also use this message parser class that lets you process your
>> messages and extract any files easily.
>>
>> http://www.phpclasses.org/mimeparser
>>
>> Take a look at this example that demonstrates how to integrate both
>> classes easily to parse your message structure:
>>
>> http://www.phpclasses.org/browse/file/14695.html
>>
> 
> I've had to have a perl script reacting to emails and acting on them. I
> did it using RetchMail (http://open.nit.ca/wiki/?page=RetchMail), which
> is mindnumbingly fast when you need to download a bunch of emails. As
> the page says, stupidly fast. As a disclaimer, it's an opensource app
> maintained by people at my workplace. Still, it's probably the fastest
> POP3 mail fetcher out there.

You do not need Perl for this. The MIME message parser mentioned above
can perfectly process a message read from the command input. You just
need to specify php://stdin as the file name.

However, I do not recommend reading messages from the standard input
unless you do not have an alternative. There are several problems:

- You can only read the message once. You cannot process the message in
multiple passes. If your script fails for some temporary fault, the
message is lost and the sender gets a permanent bounce.

- AFAIK reading the message from the command line input is specific of
Unix/Linux systems. A POP3 based solution works regardless of the OS you
are running as long as you have POP3 mailbox associated to the e-mail
address.

- Usually you need to have shell access to configure what script will
run to processe the message. Many PHP shared hosting companies do not
provide shell access.

-- 

Regards,
Manuel Lemos

Metastorage - Data object relational mapping layer generator
http://www.metastorage.net/

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux