{"id":50709226,"url":"https://github.com/coowinit/wordpress-region-email-form","last_synced_at":"2026-06-09T14:01:46.642Z","repository":{"id":350170349,"uuid":"1205613835","full_name":"coowinit/wordpress-region-email-form","owner":"coowinit","description":"Custom WordPress contact form with AJAX, region-based email routing, and lead source tracking.","archived":false,"fork":false,"pushed_at":"2026-04-09T06:06:27.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-09T08:10:41.073Z","etag":null,"topics":["ajax","contact-form","email","php","wordpress"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/coowinit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-09T05:56:02.000Z","updated_at":"2026-04-09T06:06:34.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/coowinit/wordpress-region-email-form","commit_stats":null,"previous_names":["coowinit/wordpress-region-email-form"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/coowinit/wordpress-region-email-form","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coowinit%2Fwordpress-region-email-form","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coowinit%2Fwordpress-region-email-form/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coowinit%2Fwordpress-region-email-form/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coowinit%2Fwordpress-region-email-form/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coowinit","download_url":"https://codeload.github.com/coowinit/wordpress-region-email-form/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coowinit%2Fwordpress-region-email-form/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34110012,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-09T02:00:06.510Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ajax","contact-form","email","php","wordpress"],"created_at":"2026-06-09T14:01:45.358Z","updated_at":"2026-06-09T14:01:46.628Z","avatar_url":"https://github.com/coowinit.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WordPress Contact Form by State Routing\n\nThis repository stores a lightweight Contact Us form setup for WordPress.\n\n## Features\n\n- Ajax form submission without page refresh\n- Route enquiries to different agent emails based on Australian state\n- Send a second copy to the company inbox\n- Use WordPress `wp_mail()`\n- Support logged-in and logged-out visitors\n- Include basic validation and nonce security\n\n## Files\n\n- `contact-form-template.php` — contact form markup only\n- `functions-contact-mail.php` — Ajax handler for `functions.php` or a custom include file\n\n## How to use\n\n### 1. Add the form markup\n\nCopy the contents of `contact-form-template.php` into your Contact Us page template.\n\nThis file only contains the form block and Ajax script. It does not include:\n\n- header\n- footer\n- `wp_head()`\n- `wp_footer()`\n\n### 2. Add the mail handler\n\nCopy the contents of `functions-contact-mail.php` into your theme `functions.php`, or include it from a custom file.\n\nExample:\n\n```php\nrequire_once get_template_directory() . '/inc/functions-contact-mail.php';\n```\n\n### 3. Update the recipient emails\n\nIn `functions-contact-mail.php`, edit:\n\n- `$region_emails`\n- `$company_email`\n\n### 4. Make sure SMTP already works\n\nThis code assumes your site can already send mail using `wp_mail()`.\n\n## Notes\n\n- The form requires jQuery.\n- The Ajax endpoint uses `admin-ajax.php`.\n- The form sends two separate emails:\n  - one to the regional recipient\n  - one to the company email\n- `Reply-To` is set to the visitor's email address.\n\n## Example state mapping\n\n```php\n$region_emails = [\n    'Queensland'        =\u003e 'coowin111@gmail.com',\n    'New South Wales'   =\u003e 'coowin222@gmail.com',\n    'Victoria'          =\u003e 'coowin333@gmail.com',\n    'South Australia'   =\u003e 'coowin444@gmail.com',\n    'Western Australia' =\u003e 'coowin555@gmail.com',\n];\n```\n\n## Optional cleanup before production\n\nYou can remove these debug logs after testing:\n\n```php\nerror_log('CONTACT MAIL STATE: ' . $state);\nerror_log('CONTACT MAIL TO REGION: ' . $to_region . ' RESULT=' . ($sent_region ? 'true' : 'false'));\nerror_log('CONTACT MAIL TO COMPANY: ' . $company_email . ' RESULT=' . ($sent_company ? 'true' : 'false'));\n```\n\n## License\n\nThis project is licensed under the MIT License.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoowinit%2Fwordpress-region-email-form","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoowinit%2Fwordpress-region-email-form","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoowinit%2Fwordpress-region-email-form/lists"}