BasicMail
Fall 2011, Fall 2021
My brother has an intellectual disability but loves computers. Trouble is, he's exceptionally skilled at finding settings panels and mucking around with everything until nothing works. Even with a guest account on Ubuntu, with all menu access to system settings removed, he still finds ways to make everything wonky. In another life he'd totally be that one guy who knows how to program every VCR. Anyways, our family is a little spread out, and as a result my brother doesn't get many opportunities to connect with everyone he loves.
The main reason that I didn't set him up with an e-mail account in the past was because I knew that it would constantly need fixing, would have an overwhelming number of unnecessary features, and because there would be no way to limit who he could e-mail. The solution? Build a simple e-mail interface specifically tailored to his needs.
Thanks to PHP and email IMAP features, this wasn't too difficult. Gmail offers this service for free, and because of its excellent spam filtering it seemed a no-brainer to go with them.
I first completed this project in 2011, but cleaned it up significantly for this update in 2021. It's kind of funny to realize it's been running for 10 years straight with no fundamental changes. E-mail really is a big rock in the fast-flowing torrent of internet platforms and technologies.
IMAP Update
Gmail is ending their IMAP support in 2022, requiring the use of OAuth. Not a bad idea from a security standpoint, but more than this little project can bare! I set up a new email account with my hosting provider that will continue to work, and have the original Gmail account auto-forward to this one. It ain't perfect but it gets this solution a few more years of runway.
Setting Things Up
The hardest part of all of this was getting my hosting service to enable IMAP services with SSL over port 993. I kept getting a "connection timed out" error. It took a solid week to get things working, and when I asked them to describe what they finally did to get it working, all they said was "We have enabled the specific setting related to port." So good luck! If things don't work out of the box for you, all I can say is just be persistent with tech support.
I followed this link to test things out once I had set up a Gmail account for my brother and enabled IMAP service in the Gmail settings.
Once everything was working, it didn't take long to get the interface set up.
The Interface
Here are some screen grabs of what I built. If the smudging out of every single piece of possibly personal information annoys you, too bad!
Inbox / Sent Mail
The outbox looks the exact same - just swap From with To.
Viewing a Message
Note that the "Reply to E-mail" link is only shown if the sender is in the approved list.
Replying to a message
If someone feels crafty and enters the UID of an e-mail from a sender not on the approved list, it will redirect back to the Inbox.
Composing a New Message
And again note that the To field is a simple drop-down list which only allows the email to be sent to the addresses on the approved list.
Simple and straightforward right? Here's a brief rundown of the features:
Features
- Easy to set up (just need to change the data in the config.php file)
- Works with any Gmail account with IMAP enabled
- Only allows new emails to be sent to the addresses listed in the config file
- Only allows the user to reply to emails sent from the addresses listed in the config file
- Supports incoming HTML emails (plain text outgoing messages only)
- Appears to the outside world as though the user is using a normal e-mail account** (the only special interface is on the user's side)
- Anyone can send them an email, even if they aren't on the list (this hasn't backfired yet!)
- Checks to make sure a message body is entered (forgives an empty subject line)
- Patience (debugging)
** Unfortunately I wasn't able to get SMTP sending enabled through my hosting provider, so I had to use PHPMailer. This hasn't caused any problems yet, but it could cause outgoing mail to be flagged as spam.
Code
All you should need to modify is the config.php file, and everything else is lightly commented and fairly easy to tweak if necessary.