We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 16987
    • 11 Posts
    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.
      • 28042 ☆ 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.
        Studying MODX in the desert - http://sottwell.com
        Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
        Join the Slack Community - http://modx.org
        • 28042 ☆ 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)
          Studying MODX in the desert - http://sottwell.com
          Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
          Join the Slack Community - http://modx.org
          • 28042 ☆ 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 cool cool
            Studying MODX in the desert - http://sottwell.com
            Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
            Join the Slack Community - http://modx.org
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            I’ll write this up on my sottwell.com site! This is fun grin grin

            [edit] And the "hard" part is done... the rest is just string manipulation and some database inserts.

            http://www.sottwell.com/email-posting.html
              Studying MODX in the desert - http://sottwell.com
              Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
              Join the Slack Community - http://modx.org
              • 25663 MODX Staff
              • 12,272 Posts
              I suppose you could have a plugin that triggers the check every time someone goes to the particular page that should show any document summaries. Could put flood controls in it so that it only checks if it hasn’t been checked in the last X minutes. Very cool stuff Susan! smiley
                Ryan Thrash, MODX Co-Founder
                Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
                • 17282
                • 283 Posts
                what a fantastically good idea!

                  Everytime you use Flash ... a puppy dies .....
                  R.G Taylor
                  • 14050
                  • 788 Posts
                  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.
                    • 6726
                    • 7,075 Posts
                    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 smiley
                      .: COO - Commerce Guys - Community Driven Innovation :.


                      MODx est l'outil id
                      • 14050
                      • 788 Posts
                      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.