Jump to content

Word Doc email attachment -> Website Update


TheMarsVoltaire

Recommended Posts

I have a gmail account setup so that it receives a daily email that has a daily bulletin (word doc format) attached.

 

I also have a php based site thats  homepage has a space for this daily bulletin. I setup a password protected php script on another page that allows me to paste text (I open and copy the text from the word doc attachment) into a textfield and then update a text file with that copied text. A script in the homepage pulls the text from that text file and loads it into the bulletin space on the page when it loads.

 

My question is, how can I automate this entire process in php? Would it be something like: PHP connects to gmail's pop server, finds and retrieves the email attachment, opens it, copies the text from it, and then edits the text file?

Link to comment
https://forums.phpfreaks.com/topic/40900-word-doc-email-attachment-website-update/
Share on other sites

You pretty much has to do what you suggested yourself... the tricky part will be to connect to the mail server, receive the email and extract the attached file - or it probably isn't tricky, I just haven't done it my self :)

 

I suggest you have a look at this part of the PHP manual:

 

http://no2.php.net/imap

 

When you have created a script to get the text file copied, renamed and uploaded ect. you will have to automate the whole process using something like a cronjob... or if you page is well visited you can rely on your scripts being executed enough to just add a time check:

 

$hour = $date("G",time())

 

if((18< $hour) && ($hour < 19)){

  do your stuff

}

I know this is probably impossible, but is there any way of connecting to the pop server with only a default php installation? IMAP requires c-client, and I don't have the privileges to install it nor is my administrator knowledgable enough about PHP to install it for me.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.