Had a look around online and couldnt find any decent SMTP plugin for sending and receiving emails through wordpress. Seems like it makes a lot of people angry for wordpress to do such a thing which seemed odd, so I decided to start working on one myself.
The goal of this plugin is to add the following functionality to the wordpress dashboard.
- Send Emails
- Receive Emails
- Log into any user inbox using SMTP servers user authentication.
- Create WP database to log emails and better manage them.
- Parse and display any email information.
- Setup email blasts for newsletters.
- Basic spam filter
- Adminbar notifications for unread emails.
The wordpress side of things is the easy part so I have put the effort into extracting the emails from the IMAP server from a wordpress plugin. It took quite a bit of work to get this to display any useful information, but after a while I started to make some good progress on this. Using a linux server with postfix and dovecot installed as the SMTP and IMAP servers I was able to use PHP to pull the latest emails for an individual user.
Here is the base inbox page that lists the latest emails. This is going to need major touch ups to style, but I want to get the functionality working smooth before making it look pretty.
This inbox page is a bit messy, but its working! The next thing was to be able to view the actual email body. This is also crazy messy, but it works and thats all that matters for the moment. I have listed the emails and dumped the email body below. Attachments still don’t show up, but the core components are correctly displaying.
The next stage to this would be making this a little more user friendly so emails can be read much better. I will create individual “view email” pages that will display the email and hopefully any attachments. I will work on adding controls to this page that will allow for replies, forwarding, attachments etc.
I do see some potential issues in the future with this. While it is working perfectly on my server, I am not confident its going to work straight up on another server that’s running a different operating system/mail server. Once i have a stable version of the plugin I will try to get a few people to test this out on various servers. I will work on creating a quick setup tool that will try to test various config options in order to determine what one will work best for the particular system. The install of php-imap and mail servers are requirements in order to make this work.
I’m very surprised this hasn’t been done in the past. WordPress is a CMS, but with the evolution of the web I for one would like to have everything related to my website kept in one area. Why go to a roundcube install or anything else when you can just do everything that you need to do within wordpress?