This repository has been archived on 2025-01-19. You can view files and clone it, but cannot push or open issues or pull requests.
oliverdavies.uk-old-sculpin/source/_posts/conditional-email-addresses-webform.md

30 lines
1 KiB
Markdown
Raw Normal View History

2015-03-16 21:18:03 +00:00
---
title: Conditional Email Addresses in a Webform
2020-03-08 14:32:13 +00:00
date: 2010-05-06
excerpt:
How to send webform emails to a different email address based on another
field.
2015-03-16 21:18:03 +00:00
tags:
2015-06-14 02:27:41 +00:00
- drupal-planet
- drupal-6
- conditional-email
- webform
2015-03-16 21:18:03 +00:00
---
I created a new Webform to serve as a simple Contact form, but left the main
configuration until after I created the form components. I added 'Name',
'Email', 'Subject' and 'Message' fields, as well as a 'Category' select list.
Below 'Options', I entered each of my desired options in the following format:
2015-03-16 21:18:03 +00:00
2017-03-16 08:09:52 +00:00
```language-ini
Email address|Visible name
```
2015-03-16 21:18:03 +00:00
I went back to the form configuration page and expanded 'Conditional Email
Recipients', and selected my Category. Note that the standard 'Email To' field
above it needs to be empty. Originally, I made the mistake of leaving addresses
in that field which resulted in people being sent emails regardles of which
category was selected. I then configured the rest of the form.
2015-03-16 21:18:03 +00:00
2015-06-14 02:27:41 +00:00
Then, when I went to the finished form, the category selection was available.