EEConf 2024 is around the corner! EEConf 2024
I have a page listing weekly events offered by multiple hosts. The host’s email address is listed with each event channel entry, but not displayed on the front end.
I want visitors to this page to be able to contact the host via an email contact form to obtain event access information. We do not want to show the host’s email address on the front end.
I want to set up a contact form through a link with each event listing. I would like the link from the events page to automatically insert the event host’s email address in the “To:” address field.
The “From” field will be our office email address.
The contact form will have fields for the user to enter their email and email confirmation. I want the user’s email to appear as the “Reply to:” address.
The subject field can fixed by the contact form, no matter what event or host is being queried.
Attached is a screenshot of the individual event entry. The “(Request info)” will be a link to a contact form that would need to insert the Contact Email into the contact form “To:” address field.
I’ve done similar a few times. You could use the stock email form wrapped in your channel entry tag and populate values from your entry fields, e.g.
{exp:channel:entries channel="your_channel" limit="1"}
{exp:email:contact_form user_recipients="no" charset="utf-8" recipients="{your_contact_email_field}" replyto="{your_contact_email_field}"}
<!-- subject as hidden field -->
<input type="hidden" id="subject" name="subject" size="40" value="Entry title: {title}">
<label for="from">Your Email:</label>
<input type="text" id="from" name="from" size="40" maxlength="35" value="{member_email}">
<label for="message">Message:</label>
<textarea id="message" name="message" rows="18" cols="40"></textarea>
<input name="submit" type='submit' value='Submit Form'>
{/exp:email:contact_form}
{/exp:channel:entries}
Because you’re technically sending an email to an external recipient from the site, emails can be rejected because they trigger anti-spam systems, setting DKIM and SPF records can sometimes help if you get problems.
The entries for all events in this channel (#72/{acim_groups}) are listed in one of three grids within this channel: #203/{teleconference-groups}; #204/{in_person_usa}; #205/in_person_intl};
Each of these grids have multiple entries for individual events with 6 fields. The “Description” Text field includes a “(Request info)” link to the contact form. The “Contact Email” field contains the email address of the event host. This host email is what I need placed in the “recipients” field of the email for the contact form should send. (see screen shot included in my original post)
Summary: I do not know what to place in “{your_contact_email_field}” to have the unique Contact Email channel entry for that individual event entry be placed in the recipients=”{your_contact_email_field}”. I have not been able to find a unique identifier for that unique email address entry.
Summary answer: It’s the short name of your “Contact email” field. You can find it in your field manager settings https://docs.expressionengine.com/latest/control-panel/field-manager/field-manager-settings.html - click to edit the field and you’ll see it there.
Thanks so much for your help. I’m still missing a piece. What code is needed to have the email sent to the contact email address.
Here is what I tried (that does not work):
<input type=”hidden” id=”to” name=”to” value=”{contact_email}”>
Note: I have tried using a “mailto:” link, but it does not work for contacts who only access mail online; they do not have an email client installed on their device.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.