EE Plugin: Encode Email
Expression Engine’s contact form, by default, encodes the primary email address(es) in the recipients list. However, for the people who want to allow visitors to select contacts from a dropdown menu (like myself), this meant leaving email addresses exposed to spam bots.
I wrote the first version of this quick and dirty plugin to cloak paypal email addresses on dynamic “buy it now” forms using hex. When the need for a dynamic contact form recipients presented itself, it took about 30 seconds to convert into this.
The pMachine forum thread where I first shared this with the public can be found here:
Select recipients menu for contact_form »
Note: Because of the change in EE’s hashing of the “recipients” parameter, this plugin can only be used in the Contact Form now.
What This Does
- Encode email address for use in multi-select recipients in EE contact forms.
Note: Encoding email addresses will not prevent spam/harvesting 100%, but it’s better than nothing.
Instructions
- Download and unzip the plugin
- Upload to your
/<system>/plugins/directory - Use the following code to base 64 encode any string of text between the plugin tags:
{exp:encode_string}me@email.com{/exp:encode_string}
File Details
Version: 0.2
File Size: 893 bytes
Download: pi.encode_email.zip
To use multiple contacts from a certain member group, you can use the following query, change the 1 in group_id='1' to the actual group id you want to include in the list:
{exp:email:contact_form user_recipients="false" charset="utf-8"}
<input type="hidden" name="subject" value="Contact Form Submission" />
<p><input type="text" name="name" id="name" /> <label for="name">Your Name</label></p>
<p><input type="text" name="from" id="from" /> <label for="from">Your Email</label></p>
<p>
<select name="recipients" id="recipients">
{exp:query sql="SELECT screen_name, email FROM exp_members WHERE group_id='1' ORDER BY screen_name ASC"}
<option value="{exp:encode_email}{email}{/exp:encode_email}">{screen_name}</option>
{/exp:query}
</select>
<label for="recipients">Recipient</label>
</p>
<p><textarea name="message" id="message" rows="5" cols="50"></textarea></p>
<p><input type="submit" id="submit" name="submit" value="Send Email" /></p>
{/exp:email:contact_form}


comments