x
 
Create New Page
 View Previous Changes    ( Last updated by Paul Frost (orienteer) )

Select Contact Email Form

Question: How can I create a contact form that allows you to pick an email address from a select list, and keep the email addresses encrypted?

Answer: You can hard code (or pull in from a query the addresses you want to use) the email address/name option values using PHP to encode the email address.

You’ll need to have PHP turned on for output.

Note:If running 1.6.7 - Build: 20090211 or later you may need to change some of the following code. See the post by Genesis Church

{exp:email:contact_form user_recipients="false"

<h2>Contact Form</h2

<?php
global $PREFS;

$init_size mcrypt_get_iv_size(MCRYPT_RIJNDAEL_256MCRYPT_MODE_ECB);
$init_vect mcrypt_create_iv($init_sizeMCRYPT_RAND);

$email1 base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256md5($PREFS->ini('system_folder')), 'person.one@mail.com'MCRYPT_MODE_ECB$init_vect));
$email2 base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256md5($PREFS->ini('system_folder')), 'person.two@mail.com'MCRYPT_MODE_ECB$init_vect));
?>

<select name="recipients" id="recipients">
<
option selected="selected">-- Deliver To --</option>
<
option value="<?php echo $email1; ?>">Person One</option>
<
option value="<?php echo $email2; ?>">Person Two</option>
</
select

<
p><label for="from">Your Email:</label><br /> 
<
input type="text" id="from" name="from" size="40" maxlength="35" value="{member_email}" /></p

<
p><label for="subject">Subject:</label><br /> 
<
input type="text" id="subject" name="subject" size="40" value="Contact Form" /></p

<
p><label for="message">Message:</label><br /> 
<
textarea id="message" name="message" rows="18" cols="40">Just a test email.</textarea></p

<
p><input name="submit" type='submit' value='Submit Form' /></p

{/exp:email:contact_form} 

Category:Contact Form

Category:EE1

Categories: