Hello,
I would like to add content automatically by email. It should work like this: we are sport club, the press articles about sport games should appear on the webpage. The articles are sent by email to the press by a few of our sport club members (about 10). If they are sending the emails also to a specific email adress, than the content of these emails should automatically show up on the webpage like news: a headline and a link to the full content(one content item for each article). It would be nice, if the senders email adress is checked, so just specific senders are allowed.
I didn’t found any php script for adding email content to a mysql database and then I think a snippet is needed to take this content out of the database and display it on the webpage.
Any suggestions are welcome.
Thanks in advance.
-
☆ A M B ☆
- 24,524 Posts
Such a script would need to insert the data from the email into the site_content table with a specified "parent" value so that the new document would be included in a standard Ditto call.
There are a lot of php-based webmail applications that directly access a domain’s mail folders, so the concept is certainly feasible.
The script would behave much like the webmail app to begin with. Then it would search for mail with a specific subject line, then parse the content, format it and insert it into the site_content table.
Of course, TVs would complicate things a bit, but it would just need a more complex parsing and database insertion section.
All of this would be completely independent of the MODx installation itself; unless one wanted to make it into a module for finer control.
-
☆ A M B ☆
- 24,524 Posts
Hmmm... found this, it might be a good place to start.
http://www.ibm.com/developerworks/edu/os-dw-os-php-webmail.html
(registration required, but it’s easy enough to get one; I’ve had one with them for years)
-
☆ A M B ☆
- 24,524 Posts
Actually, this tutorial uses the imap function of PHP (check your phpinfo in Reports -> System Info and see if the first block has "with-imap..." in it. Mine does.)
With this, you can access through the POP or IMAP server just like any mail client. I’m trying to get it to work right now.
got it!!!
http://il2.php.net/manual/en/function.imap-open.php
// connect to the mail server
$mbox = imap_open("{localhost:143}INBOX", $uname, $upass);
$total = imap_num_msg($inbox);
echo $total;
The rest is cake
-
☆ A M B ☆
- 24,524 Posts
I’ll write this up on my sottwell.com site! This is fun
[edit] And the "hard" part is done... the rest is just string manipulation and some database inserts.
http://www.sottwell.com/email-posting.html
what a fantastically good idea!
Everytime you use Flash ... a puppy dies .....
R.G Taylor
What an awesome way to allow some remote blogging.
Jesse R.
Consider trying something new and extraordinary.
Illinois Wine
Have you considered donating to MODx lately?
Donate now. Every contribution helps.
Yeah really great idea !
Back in the textpattern days I remember the devs
playing with XML-RPC to achive that but your solutions seems simpler and more elegant, I’ll make sure to do my homework and follow up on this
.: COO - Commerce Guys - Community Driven Innovation :.
MODx est l'outil id
php.net is showing that it should work with gmail. However, I am unable to get it to open the stream. If I can get this working, that would be really sweet.
Jesse R.
Consider trying something new and extraordinary.
Illinois Wine
Have you considered donating to MODx lately?
Donate now. Every contribution helps.