I’m using tectite.com’s Formmail php script. I use a formmail.ini file to obscure email addresses from spammers. That ini file looks like this (nothing else in that file):
[special_fields]
recipients = "[email protected]"
email = "[email protected]"
Note that there are two "special fields," and that they both use the same email address.
This was all working a few days ago, has been for months, then the script stopped working. I determined that the script was corrupt by replacing it with a fresh copy from tectite.com. But then I started getting this error message:
The following error occurred in FormMail :
The email address "" is not valid: missing ‘@’
After extensive troubleshooting, I’ve found that removing the line ’email = "[email protected]"’ from the ini file solves the error. But I need that option restored.
In replacing the formmail script, it got updated to version 9.26.
Any ideas? Did the latest version change something that keeps my previous ini file from working like it used to?
I tried single quotes. I tried a comma between the two special fields. I tried retyping the addresses. I tried different email addresses. And I tried repeating ‘[special_fields]’, one for each field. No dice… And I can’t find any two-line samples on tectite.com
2
Answers
OK, figured it out. The correct way to manipulate the From address is to use a hidden field, like so:
There are a couple ways to hide the email address from spammers. One, is to create an alias, like so:
And then add the alias definition to the ini file, in my case:
It's probably possible to put the mail_options in the ini file, but my website has multiple forms on different pages, each with their own unique set of mail_options (I didn't show those other options in my example code). I tried splitting the mail_options: one set in the html code, and another set, with the FromAddr value, in the ini file, but that didn't work. Apparently formmail only honors one line of mail_options.
The "email" special field is to hold the address of the person who has filled in your form.
So, it generally makes no sense to set that yourself.
I’d recommend getting your form to work properly without setting the "email" field, and then consider why you’re trying to set it.
Perhaps the "email" field is also in your HTML and that’s overriding your INI file setting. But again, that’s what’s supposed to happen.