Search

Has anyone played around with getting an incoming e-mail to trigger an event with Symphony 2? I’m playing with the idea of writing a nice, simple issue tracker/support application using Symphony and I’d like to be able to initiate new support tickets using e-mails.

I have been thinking about creating a way to post blog entries via mail. My intention is to build on Nick Dunn’s method to import external xml-feeds. But instead of fetching data from a remote site’s xml feed get it from a mail.

But I can’t see a way to do this with Symphony only. Rather, just like with Nick’s solution, my plan is to use an ‘external’ php file to parse incoming mail, build a string that contains the correct stuff to be used in a event and then call a Symphony page that has that event attached.

To trigger the execution of the script, I’m going to use my shared server’s ability to pipe mail to scripts automaticly on arrival.

Hope this gives you some ideas on how to solve your on problem.

I did a similar thing a few years ago at an agency I worked at. We had the idea to collate peoples’ experiences from going to music festivals over the summer — in real time — to the office. People could email messages, photo or video to an office email address and my script would access the POP3 inbox, parse new messages and grab the attachments, and mark them as read.

There was a free .NET component that made this very easy, so I’m sure this will be possible using PHP.

For each new email you could build a POST array and send it to off using wget or CURL to a Symphony page with an Event attached (blog post).

But this will only work if your hoster allows you to “send emails to scripts” and most of them don’t. In this case a POP3-polling script would be the only solution.

PHPs imap_open() supports POP3, IMAP and NNTP. Automatic expunging (delete all emails after reading them) is also supported. This should make syncing your mailbox with a section via an event a breeze.

It was actually really easy.

I’ve set up a Demo and the Sourcecode for test@phoque.de.

Every mail you send there will be displayed in an XML-Feed, expunging has been disabled. Appending ?strip-signature to the URL will make it strip signatures from incoming emails.

Sorry for the abuse of CDATA and the messy code, I was just too lazy to tidy everything up. :-)

Edit: Nick, apparently attachments will simply… vanish. :-D

You guys rock my world! This is exactly what I wanted - I would love for this to be part of the core product, but this will work just fiiine :)

This is such niche functionality I can’t see this being part of the core. But it could certainly be packaged up into an Extension that provides a ready-made Data Source. It could provide configuration options in Preferences for the server username/password etc.

But the requirements for using this information is so unique to each project, I doubt a generic extension would be useful beyond “wow, that’s quite cool!”…

Right. But it could be a sort of base extension that provides functionality for other, more specific, extensions. Think ASDC.

That’s actually really cool. I always thought this sort of thing was much harder than that. I’m sure a generic extension would be very useful and could be easily incorporated into other extensions.

Gettings things submitted by email like blog posts or anything else is not as simple as you may think.

Think of security: How do you verify the identity of the sender? You can’t just trust the ‘from’ address because it can be forged easily. Maybe you can use some sort of signing of email.

You can also require to provide username/password in subject line or in the first line of email body but that’s not secure.

Then how do you actually get an email to your script? There are 3 ways to do this: forward email to a php script, write your own server, sort of email filter daemon that always listens on specific port, and finally the most simple way is to just have your emails delivered to the regular pop3 mailbox, than have your php script use imap extension to periodically check this mailbox.

The last one is the easiest for the end-user to implement, all is needed is to setup a cron job to run your php script every ‘n’ minutes to check the mailbox.

So, you have to think of all these things before you say “it’s easy to do this”

I was talking about how easy it was to get PHP to poll a POP3-mailbox, not how to implement authentication.

My use case was essentially tracking support requests and forming formal issues out of them. I’d like to allow people to e-mail support requests in, as well as register for an account on the front end and file issues directly. I got most of the way there last night, but then GetSatisfaction.com released their new site. Erk - I’m not sure, but GetSatisfaction might actually be usable now!

In any case, I could see passing incoming messages via Akismet before moving them out of a ‘quarantine’ area.

I still want subsectionfield (or repeating elements within sections) finished up more than I want this (Rowan: poke).

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details