Form spam and rabbit holes
As an early morning interlude to my working on a Power Platform contract for a local non-profit, and my CompTIA A+ exam prep, I decided to update this website. The goal was only to replace the backend processor for the contact form so that I would actually receive the emails. In the process I ended up going down an unexpected path.
I discovered that the email form submissions were being rejected at by my email provider (Microsoft 365) ‘at the edge’ (that is not even getting to a Junk folder), due the way the form handling code was setting the email headers.
The Sender
and related fields were correct, but the From
fields was set
according to the submitter’s indication of their email address. Unfortunately
(or perhaps fortunately, but not helpful for getting the mail), modern spam
detection considers that spoofing, and rejects it.
Intially I was only planning to replace the From
with my own email address
(so the emails were from me, to me, with a subject indicating the sender’s
purported email address). I achieved that quite quickly, but then I realized
that spammy contact form submissions would be coming in on one of my email
addresses and ‘giving my domain a bad name’.
I therefore decided to switch to a different contact form backend provider.
In the process, among other things, I discovered a peculiarity of Markdown
as generated by Hugo. It seems when there are multiple
‘shortcodes’ that one cannot avoid the shortcode being wrapped in a HTML
‘paragraph tag’ (<p>
).
The problem with that is that the form shortcode contains other HTML elements that are not allowed in a paragraph tag.
It took a little finagling, but I figured out how to make resolve that issue. (Basically I made sure there was only one shortcode so that the multiple paragraph logic in Hugo would not be triggered).
So, now I (seem to) have a working contact form that won’t be rejected as spam (and which captures spam contact submissions, so I can quickly delete them without having them delivered to my email).
Now back to the contract work, and training (which I am enjoying, as well as making progress with them).