# Code Snippets Find below a list of code snippets that can be used in your projects. These are all snippets that we already use in our projects and are tested. ## Email Button A simple email button that allows users to email their selected city councillor.
×

Select Your City Councillor

### Basic Email Structure The email template is defined in the `emailCouncillor` function using two main components: ```javascript const subject = "Constituent Feedback - [Your Issue]"; const body = `Dear ${councillor.name}, // ... rest of the email content `; ``` ### How to Modify the Template #### 1. Changing the Subject Line Locate the `subject` constant in the `emailCouncillor` function: ```javascript const subject = "Constituent Feedback - [Your Issue]"; ``` Replace the text inside the quotes with your desired subject line. #### 2. Modifying the Email Body Find the `body` template string (marked with backticks `) and modify its content: ```javascript const body = `Dear ${councillor.name}, Your new email template goes here...`; ``` #### 3. Available Variables The following variables are available for use in your template: - `${councillor.name}` - Councillor's full name - `${councillor.ward}` - Ward name - `${councillor.title}` - Councillor's title - `${councillor.email}` - Councillor's email address #### 4. Special Characters and Formatting - Use `\n` for line breaks - Avoid using special characters like `"` or `'` directly - escape them if needed - Remember that HTML formatting will not work in email clients ### Example Templates #### General Inquiry Template ```javascript const subject = "General Inquiry from Constituent"; const body = `Dear ${councillor.name}, I am a constituent from ${councillor.ward} seeking information about...`; ``` #### Specific Issue Template ```javascript const subject = "Urgent: Traffic Safety Concern"; const body = `Dear ${councillor.name}, I am writing regarding a safety concern at the intersection of...`; ``` #### Meeting Request Template ```javascript const subject = "Meeting Request from ${councillor.ward} Constituent"; const body = `Dear ${councillor.name}, I would like to schedule a meeting to discuss...`; ``` ### Implementation Tips 1. Keep subject lines concise and specific 2. Include clear calls to action in the body 3. Maintain professional formatting 4. Test the template with various email clients 5. Consider mobile device compatibility ### Technical Notes - The template uses `encodeURIComponent()` to properly encode special characters - Maximum email length may vary by email client - Some email clients may have limitations on mailto link functionality ??? "Edmonton Council Emailer Code" ```html
×

Select Your City Councillor

```