Skip to content

Commit

Permalink
Merge pull request #150 from mbrodala/patch-1
Browse files Browse the repository at this point in the history
Fall back to system from address for application mail
  • Loading branch information
benjasper authored Aug 30, 2024
2 parents 647c797 + fca2bd0 commit afdfac9
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions Classes/Controller/ApplicationController.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
use TYPO3\CMS\Core\Resource\ResourceStorageInterface;
use TYPO3\CMS\Core\Resource\StorageRepository;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\MailUtility;
use TYPO3\CMS\Core\Utility\MathUtility;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
use TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException;
Expand Down Expand Up @@ -454,7 +455,10 @@ public function createAction(Application $newApplication, Posting $posting = nul
// Prepare and send the message
$mail
->subject(LocalizationUtility::translate("fe.email.toContactSubject", 'jobapplications', [0 => $currentPosting->getTitle()]))
->from(new Address($this->settings["emailSender"], $this->settings["emailSenderName"]))
->from(new Address(
$this->settings["emailSender"] ?: MailUtility::getSystemFromAddress(),
$this->settings["emailSenderName"] ?: MailUtility::getSystemFromName(),
))
->replyTo(new Address($newApplication->getEmail(), $newApplication->getFirstName()." ".$newApplication->getLastName()))
->assignMultiple(['application' => $newApplication, 'settings' => $this->settings, 'currentPosting' => $currentPosting]);

Expand Down Expand Up @@ -521,7 +525,10 @@ public function createAction(Application $newApplication, Posting $posting = nul

$mail
->subject($subject)
->from(new Address($this->settings["emailSender"], $this->settings["emailSenderName"]))
->from(new Address(
$this->settings["emailSender"] ?: MailUtility::getSystemFromAddress(),
$this->settings["emailSenderName"] ?: MailUtility::getSystemFromName(),
))
->to(new Address($newApplication->getEmail(), $newApplication->getFirstName()." ".$newApplication->getLastName()))
->assignMultiple(['application' => $newApplication, 'settings' => $this->settings]);

Expand Down

0 comments on commit afdfac9

Please sign in to comment.