Should I build a PHPMailer video training course?

I spend a lot of time working on PHPMailer, and even more answering questions about it on Stack Overflow, yet gain very little from doing so. There is a certain amount of professional pride and reputation involved, but that doesn’t pay the bills. I am lucky enough to have a few GitHub and Patreon sponsors (thank you!), but that doesn’t amount to much. The same questions come up again and again, and repeating the same answers over and over, to people who are convinced that they must be the very first person ever to have had trouble sending email through GoDaddy, gets dull and tiring. I also run Smartmessages.net (a privacy-first email marketing service), so I am continuously exposed to large-scale email issues that small senders never have to worry about, but that are near-impossible to find advice about.

Email is a funny thing; it’s been around forever and is absolutely taken for granted, but it’s horribly complicated (way more so than, say, HTTP), and many developers, especially new ones, have absolutely no idea how it works – hence the repeated mistakes. Email grows more complex by the year, with the addition of things like SPF, DKIM, DMARC, ARC, MTA-STS and more. Some of it is really quite tricky yet the resources available for it either suck or are decades old. I’ve previously pitched book proposals to popular publishers (including O’Reilly and Packt) on “Modern email”, but have always been rejected on the basis that it’s not of interest or “outdated”, even though email usage is forever growing and changing.

So I’ve been thinking about putting together a training video course on using PHPMailer, diagnosing related problems, and using email in general. Such courses are apparently very popular, though I have to admit to not using them much myself, preferring text. I’ve been heartened by the success of projects such as Christoph Rumpel’s Laravel Core Adventures, along with his valuable advice on how he built that. I’ve been impressed by the lovely Jeff Geerling‘s dedication to his ansible book and audience, and have contemplated going the self-publishing route, but a book is a really big commitment, especially on such an enormous subject as email. Video courses are a bit more flexible, though keeping them up to date has its own issues, as Jeffrey Way has said about his amazing output on Laracasts.

The big issue is my audience. I know that it’s going to be primarily junior and novice developers with little experience needing help putting together their first contact form, so it needs to be pitched quite low, at least to start with. I gather that the primary feeder for video courses is social media, but my social media profile (principally Twitter; being a privacy advocate means I really don’t want to go anywhere near Facebook) is mainly more experienced developers, who are probably not the ones who need this kind of help, though you never know – it may just be my impostor syndrome assuming that all these clever people already know about this stuff!

In summary: there is fertile ground for such content, there’s little competition, I’ve got all the experience, equipment, and position needed to do it, but I need some help and encouragement with putting together a platform and reaching my audience. Finally, since I really need to dogfood this sort of thing, please sign up to my PHPMailer mailing list!

Minimal jQuery and extensions in Laravel

I recently needed to add a simple tag editor to a form input. I initially thought that Vue might help with this. That was a big mistake! Vue is seemingly pretty hopeless for this kind of thing – you can’t really use it for “sprinkling” JS elements, and progressive enhancement is a complete non-starter; that’s really more the domain of old-school jQuery, though I hear good things about alpine.js for this kind of enhancement. I learned a lot about Vue that I hadn’t planned on doing, but the overall impression was that it was simply the wrong tool for the job. I am not interested in building an SPA, and I’m certainly not out to rebuild my entire site just for sake of a single widget! My analogy for Laravel and Vue is like oil and vinegar in a salad dressing; they will happily coexist in the same bottle and taste great together, but they really like to be separate.

So, back to jQuery I go. jQuery was disabled by default in Laravel 6, but it’s just commented out in resources/js/bootstrap.js. It’s already included in the npm packages.json config file, so running npm install loads it into node_modules. I was really unclear about how additional JS modules should be added to Laravel using Mix. This was also a bit confusing because there isn’t really much you can point at and say “that’s mix”; it really comes down to what you put in webpack.mix.js in the project root and the npm run devscript that builds assets. However, the main thing that this does is load app.js, but then I found that things like this should be added in bootstrap.js (which is loaded by app.js) rather than adding them to the the mix config.

So the aim of the exercise was to add a tagging UI widget that takes a standard text input full of comma-delimited terms, and turns it into a pretty clickable tag element. Out of many worthy options, I settled on Tagify. After adding it with npm i @yaireo/tagify --save I had trouble figuring out where to actually load it from, but eventually I got it working by adding:

require('@yaireo/tagify/dist/jQuery.tagify.min.js');

to my bootstrap.js file, and evidently this looks in node_modules/to find the file without any additional help. After this I created a script in public/js/editthing.js (because inline scripts are worth avoiding if you’re serious about your CSP) that turned the standard input into a tag widget:

$('#tags').tagify();

and this script was loaded from blade using Laravel’s asset helper, which creates appropriate base URLs for public resources:

<script src="{{ asset('js/editthing.js') }}"></script>

I sometimes find Laravel docs and articles infuriating – there is often both too much and too little information at the same time, or they say things like “just add it to mix”. Many articles on simple subjects like this subvert Laravel’s features to shortcut to “working” (but ultimately counterproductive) solutions, and I wanted to approach this “the Laravel way”. For that reason I thought I’d make detailed notes for these very simple steps that I couldn’t find written down together elsewhere!

HTH