email posts

Goodbye, Google G Suite

When I registered my domain “tobymackenzie.com” in 2009, Dreamhost offered the then free Google Apps to provide email for the domain. Already having a normal Gmail account and preferring the labels system over folders, I went with it. For 12 some years, it provided my email service for that domain. It changed names and eventually became “G Suite legacy free edition” after they started charging all new accounts. But this summer they are finally killing off the free version, requiring me to pay up or leave. I chose to leave, migrating over to my existing Fastmail account being used for other domains.

Continue reading post "Goodbye, Google G Suite"

Sending email attachments with PHP `mail`

I recently had to set up a PHP script to send an email with an attachment. With the current version of our CMS, we have swiftmailer available, which would make this easy, but for this site, I didn’t have it easily available. I considered bringing it in, but since this was just a simple script, I decided to give a go at doing it directly with PHP’s built in mail() function. I found an answer on StackOverflow to guide me. Many respondents to that question recommended just using a library, but the answers that didn’t seemed reasonable.

It took me a number of failed attempts to get the headers and line-breaks just right so that both the email message and attachment sent properly, but I got it working. The code of my solution was fairly specific to the application, so I’ve modified it to make it more generically applicable for this post. The (untested but generic) variant of the solution looks like:

Continue reading post "Sending email attachments with PHP `mail`"