Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Honor the overridden Craft mailer component #188

Open
wants to merge 1 commit into
base: develop-v4
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]
Fixed an issue where the overridden Craft mailer component wasn't taken into account ([#187](https://github.com/hybridinteractive/craft-contact-form-extensions/pull/187))

## [4.2.2] - 2022-11-14
Fixed an issue where the settings tabs were not showing [#164](https://github.com/hybridinteractive/craft-contact-form-extensions/issues/164)

Expand All @@ -26,7 +29,7 @@ message['saveSubmissionOverride'] -> message['disableSaveSubmission']
## [1.3.0] - 2022-04-14
- Adding ability to override recaptcha on a per form basis. [#108](https://github.com/hybridinteractive/craft-contact-form-extensions/issues/108)
- Override for saving to db on a per form basis
- Add ability to disable the email confirmation should be sent on a specific form.
- Add ability to disable the email confirmation should be sent on a specific form.

## [1.2.8] - 2021-10-19
- Fixed Second form on page does not send [#78](https://github.com/hybridinteractive/craft-contact-form-extensions/issues/78) - Added unique id's to the functions and id tags to make the recaptcha separate for each form.
Expand All @@ -47,7 +50,7 @@ message['saveSubmissionOverride'] -> message['disableSaveSubmission']
- Fixed a bug that was causing `lightSwitch` fields to be out of sync [#87](https://github.com/hybridinteractive/craft-contact-form-extensions/issues/87)

## [1.2.3] - 2020-10-23
- Added `Subject` to Submissions Detail page.
- Added `Subject` to Submissions Detail page.

## [1.2.2] - 2020-08-28
- Added `fromName` for confirmation email - Thank you [@skoften](https://github.com/skoften) and [@jesuismaxime](https://github.com/jesuismaxime)
Expand Down Expand Up @@ -84,7 +87,7 @@ message['saveSubmissionOverride'] -> message['disableSaveSubmission']
### Added
- Ability to override `toEmail` inside your form
- Ability to override `template` inside your form (thanks @helderdb)
- Ability to hide the badge when using ReCaptcha V3
- Ability to hide the badge when using ReCaptcha V3

### Fixed
- Fixed an issue with email being sent from the wrong address (thanks @helderdb)
Expand Down
5 changes: 3 additions & 2 deletions src/ContactFormExtensions.php
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,9 @@ private function _registerContactFormEventListeners(): void
$message = new Message();
$message->setTo($e->submission->fromEmail);

if (isset(App::mailSettings()->fromEmail)) {
$message->setFrom([Craft::parseEnv(App::mailSettings()->fromEmail) => Craft::parseEnv(App::mailSettings()->fromName)]);
$mailerComponent = Craft::$app->get('mailer');
if (isset($mailerComponent->from)) {
$message->setFrom($mailerComponent->from);
} else {
$message->setFrom($e->message->getTo());
}
Expand Down