Select recipents menu for contact_form.
Posted: 18 January 2007 11:51 AM   [ Ignore ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  406
Joined  03-17-2006

I’m not able to get this to work. I get an error that says this:

The form you submitted contained the following errors

  * One or more of your recipient emails is invalid.
  * Your email had no valid recipients.

Return to Previous Page

Here is the code used (real emails replaced):

<select name=“to”>
<option value=”<?php echo base64_encode(‘foo@foo.com’); ?>”>Test 1</option>
<option value=”<?php echo base64_encode(‘foo@foo.com’); ?>”>Test 2</option>
</select>

I should note that I do have ‘Allow PHP’ set to ‘yes’ in the template preferences and I’ve used both ‘input’ and ‘output’ in the parsing stage.

Does base64_encode only work on specific versions of PHP?

Profile
 
 
Posted: 18 January 2007 06:26 PM   [ Ignore ]   [ # 1 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  5931
Joined  11-23-2003

Split from this thread.  We prefer that when you have an issue that matches an old thread please create a new thread and link to the older thread. 

Please give me a link to the page that you are working on so that I can view the source for the form.  Otherwise you can post the source here.  Specifically I want to see the source of the form.

 Signature 

WebmasterBasic: Rent a Webmaster | EE 2.0:  A designers dream becomes a developers dream | Follow me on Twitter.

Profile
 
 
Posted: 19 January 2007 11:26 AM   [ Ignore ]   [ # 2 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  406
Joined  03-17-2006
John Fuller - 18 January 2007 06:26 PM

Split from this thread.  We prefer that when you have an issue that matches an old thread please create a new thread and link to the older thread.

Really? I would think you’d want to keep the issues together in the same thread because. I mean, I’m using the same code that was in the thread. Either way my code is below.

Please give me a link to the page that you are working on so that I can view the source for the form.  Otherwise you can post the source here.  Specifically I want to see the source of the form.

{exp:email:contact_form user_recipients="true" charset="utf-8"}

                    
<h3>Contact Form</h3>
                    
                    <
p><label for="to">Reason for Contact?:</label><br />
                    <
select name="to">
                        
{if segment_3 == "gi"}
                            
<option value="<?php echo base64_encode('person@foo.com'); ?>" selected="selected">General Information</option>
                        
{if:else}
                            
<option value="<?php echo base64_encode('person@foo.com'); ?>">General Information</option>
                        
{/if}
                        {if segment_3
== "mi"}
                            
<option value="<?php echo base64_encode('person@foo.org'); ?>" selected="selected">Membership Information</option>
                        
{if:else}
                            
<option value="<?php echo base64_encode('person@foo.org'); ?>">Membership Information</option>
                        
{/if}
                        {if segment_3
== "vga"}
                            
<option value="<?php echo base64_encode('person@foo.com'); ?>" selected="selected">Visitor Guide Advertising</option>
                        
{if:else}
                            
<option value="<?php echo base64_encode('person@foo.com'); ?>">Visitor Guide Advertising</option>
                        
{/if}
                        {if segment_3
== "help"}
                            
<option value="<?php echo base64_encode('person@foo.org'); ?>" selected="selected">I Need Help</option>
                        
{if:else}
                            
<option value="<?php echo base64_encode('person@foo.org'); ?>">I Need Help</option>
                        
{/if}
                        
<option value="<?php echo base64_encode('person@foo.com'); ?>">Developer Test</option>
                    </
select></p>
                                        
                    <
p><label for="name">Your Name:</label><br />
                    <
input type="text" name="name" size="40" maxlength="35" /></p>

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

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

                    <
p><label for="message">Message:</label><br />
                    <
textarea id="message" name="message" rows="18" cols="40"></textarea></p>
                    
                    
{if captcha}

                    
<p>
                        <
label for="captcha">Spam Protection:</label><br />
                        
{captcha}<br />
                        <
input type="text" name="captcha" value="" size="20" maxlength="20" style="width:140px;" />
                    </
p>

                    
{/if}

                    
<p><input name="submit" type='submit' value='Submit Form' /></p>
{/exp:email:contact_form}
Profile
 
 
Posted: 19 January 2007 02:21 PM   [ Ignore ]   [ # 3 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  147
Joined  10-21-2005

When you use base64_encode(), and you view sorce, is it outputting correctly?  If so, try changing user_recipients to “false”, and instead of using “to” for your select field name, change it to “recipients”.

This is my contact form code…ignore the {exp:encode_email} tags, as that was just a plugin I wrote to use base64_encode() for the email address…I also have custom query to list my staff, which you could ignore (or use, whichever).

{exp:email:contact_form user_recipients="false" charset="utf-8"}
        
<input type="hidden" name="subject" value="Contact Form Sumission" />
        <
p class="form"><input type="text" name="name" id="name" /> &nbsp; <label for="name">Your Name</label></p>
        <
p class="form"><input type="text" name="from" id="from" /> &nbsp; <label for="from">Your Email</label></p>
        <
p class="form">
            <
select name="recipients" id="recipients">
                <
option value="{exp:encode_email}sales@foo.com{/exp:encode_email}">Sales</option>
                <
option value="{exp:encode_email}support@foo.com{/exp:encode_email}">Support</option>
                <
option value=""></option>
                
{exp:query sql="SELECT member_id, username, screen_name, email FROM exp_members WHERE group_id='1' OR group_id='6' OR group_id='7' OR group_id='8' ORDER BY screen_name ASC"}
                {exp
:member:custom_profile_data member_id="{member_id}"}{if member_onhold == "No"}
                {if segment_2
== username}<option value="{exp:encode_email}{email}{/exp:encode_email}" selected="selected">{screen_name}</option>
                
{if:else}<option value="{exp:encode_email}{email}{/exp:encode_email}">{screen_name}</option>{/if}
                {
/if}{/exp:member:custom_profile_data}
                {
/exp:query}
            
</select>
            &
nbsp; <label for="recipients">Recipient</label>
        </
p>
        <
p class="form"><textarea name="message" id="message" rows="5" cols="50"></textarea></p>
        <
p class="form"><input type="submit" id="submit" name="submit" value="Send Email" /></p>
        
{/exp:email:contact_form}
 Signature 

1.6.4 | 20080829 | business | pleasure

Profile
 
 
Posted: 19 January 2007 04:07 PM   [ Ignore ]   [ # 4 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  5931
Joined  11-23-2003

Expressive Monkey, opening a new thread is a general preference.  We are not hardcore believers about it.  I just find that new threads are easier to track for me doing support.  If you are an added voice at the end of an old, long thread then you are more likely to fall through the cracks. 

The suggestion from TechWrench looks good to me, let me know if that does not work for you.

 Signature 

WebmasterBasic: Rent a Webmaster | EE 2.0:  A designers dream becomes a developers dream | Follow me on Twitter.

Profile
 
 
Posted: 22 January 2007 11:27 AM   [ Ignore ]   [ # 5 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  406
Joined  03-17-2006

John, I’m for whatever works best. I guess I didn’t know that it was a recommended practice. Good to know.

TechWench, Good idea about the recipients. I’ll give it shot. Would you care to share your encode_email plugin? I’d rather not have to have “enable php?” set to yes if I don’t have to.

Profile
 
 
Posted: 22 January 2007 11:36 AM   [ Ignore ]   [ # 6 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  147
Joined  10-21-2005

Sure.  No problem.  It’s attached.  grin

File Attachments
pi.encode_email.zip  (File Size: 1KB - Downloads: 225)
 Signature 

1.6.4 | 20080829 | business | pleasure

Profile
 
 
Posted: 22 January 2007 12:05 PM   [ Ignore ]   [ # 7 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  406
Joined  03-17-2006
TechWench - 22 January 2007 11:36 AM

Sure.  No problem.  It’s attached.  grin

Thank so much! That fixed the error I was getting but I’m not receiving the test emails I’ve sent. Any ideas what would cause that? I’ve tried two of my email addresses and haven’t received the email to either address.

Profile
 
 
Posted: 22 January 2007 01:33 PM   [ Ignore ]   [ # 8 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  147
Joined  10-21-2005

Gotta ask…

Is the Email module enabled?

The reason I ask is because I did that once.  No errors.  Nothing.  But never got the emails.  I pulled my hair out for days, until I *finally* noticed it when I went in to check on another module.  D’oh!

 Signature 

1.6.4 | 20080829 | business | pleasure

Profile
 
 
Posted: 22 January 2007 01:42 PM   [ Ignore ]   [ # 9 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  406
Joined  03-17-2006

yeah it’s enabled. smile It worked before I added this base64 stuff.

Profile
 
 
Posted: 22 January 2007 03:53 PM   [ Ignore ]   [ # 10 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  406
Joined  03-17-2006

Hmmm… seems to be working now. Not sure what I did different. My server has been playing with me lately. Thanks again for the plugin! wink

Profile
 
 
Posted: 17 November 2008 10:49 AM   [ Ignore ]   [ # 11 ]  
Grad Student
Rank
Total Posts:  36
Joined  07-24-2003

I’m attempting to use the encode_email plugin. But I receive this erroe

Fatal error: Call to undefined function: mcrypt_get_iv_size() in ../plugins/pi.encode_email.php on line 20

any suggestions

Thanks

Profile
 
 
Posted: 17 November 2008 01:33 PM   [ Ignore ]   [ # 12 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  147
Joined  10-21-2005

That error means the mycrypt extension for php isn’t installed on your server.  I’m not sure if there’s another way to encrypt the emails (and still make sure they are recognized by EE’s contact form), since when I wrote this last year I basically copied the encryption functions in the EE core.

 Signature 

1.6.4 | 20080829 | business | pleasure

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 09:33 AM
Total Registered Members: 77476 Total Logged-in Users: 40
Total Topics: 101513 Total Anonymous Users: 24
Total Replies: 544253 Total Guests: 259
Total Posts: 645766    
Members ( View Memberlist )