Skip to content
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
10 changes: 8 additions & 2 deletions Classes/DirectMailUtility.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
use TYPO3\CMS\Core\Error\Http\ServiceUnavailableException;
use TYPO3\CMS\Core\Exception\SiteNotFoundException;
use TYPO3\CMS\Core\Http\ImmediateResponseException;
use TYPO3\CMS\Core\Http\ServerRequestFactory;
use TYPO3\CMS\Core\Imaging\Icon;
use TYPO3\CMS\Core\Imaging\IconFactory;
use TYPO3\CMS\Core\Messaging\FlashMessage;
Expand Down Expand Up @@ -1523,7 +1524,7 @@ public static function initializeTsfe(int $pageId, int $language = 0, bool $useC
} else {
$GLOBALS['TSFE'] = GeneralUtility::makeInstance(TypoScriptFrontendController::class, $GLOBALS['TYPO3_CONF_VARS'], $pageId, 0);
}


// for certain situations we need to trick TSFE into granting us
// access to the page in any case to make getPageAndRootline() work
Expand All @@ -1533,8 +1534,13 @@ public static function initializeTsfe(int $pageId, int $language = 0, bool $useC
$GLOBALS['TSFE']->gr_list = $pageRecord['fe_group'];

$GLOBALS['TSFE']->sys_page = GeneralUtility::makeInstance(PageRepository::class);
$GLOBALS['TSFE']->getPageAndRootlineWithDomain($pageId);

if ($versionInformation->getMajorVersion() === 10) {
$request = $GLOBALS['TYPO3_REQUEST'] ?? ServerRequestFactory::fromGlobals();
$GLOBALS['TSFE']->getPageAndRootlineWithDomain($pageId, $request);
} else {
$GLOBALS['TSFE']->getPageAndRootlineWithDomain($pageId);
}

// restore gr_list
$GLOBALS['TSFE']->gr_list = $groupListBackup;
Expand Down
51 changes: 27 additions & 24 deletions Classes/Dmailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ class Dmailer implements LoggerAwareInterface
* @var MarkerBasedTemplateService
*/
protected $templateService;

protected $message = '';

protected $notificationJob = false;

protected function getCharsetConverter()
Expand Down Expand Up @@ -679,7 +679,7 @@ public function dmailer_setBeginEnd(int $mid, string $key)
$mail->setTo($this->from_email, $from_name);
$mail->setFrom($this->from_email, $from_name);
$mail->setSubject($subject);

if ($this->replyto_email !== '') {
$mail->setReplyTo($this->replyto_email);
}
Expand Down Expand Up @@ -990,21 +990,30 @@ public function setContent(&$mailer)
*/
public function sendTheMail($recipient, $recipRow = null)
{
if ($this->replyto_email) {
$replyTo = ['mail'=> $this->replyto_email, 'name' => $this->replyto_name];
} else {
$replyTo = ['mail'=> $this->from_email, 'name' => $this->from_name];
}
/** @var MailMessage $mailer */
$mailer = GeneralUtility::makeInstance(MailMessage::class);
$mailer->setFrom(array($this->from_email => $this->from_name));
$mailer->setSubject($this->subject);


$versionInformation = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Information\Typo3Version::class);
if ($versionInformation->getMajorVersion() === 10) {
$mailer->from(new Address($this->from_email, $this->from_name));
$mailer->subject($this->subject);
$mailer->priority($this->priority);
$mailer->replyTo(new Address($replyTo['mail'], $replyTo['name']));
// set the recipient
$mailer->to(new Address($recipient->getAddress(), $recipient->getName()));
} else {
$mailer->setFrom(array($this->from_email => $this->from_name));
$mailer->setSubject($this->subject);
$mailer->setPriority($this->priority);
}

if ($this->replyto_email) {
$mailer->setReplyTo(array($this->replyto_email => $this->replyto_name));
} else {
$mailer->setReplyTo(array($this->from_email => $this->from_name));
$mailer->setReplyTo(array($replyTo['mail'] => $replyTo['name']));
// set the recipient
$mailer->setTo($recipient);
}

// setting additional header
Expand Down Expand Up @@ -1037,23 +1046,17 @@ public function sendTheMail($recipient, $recipRow = null)
$mailer->setReturnPath($this->dmailer['sys_dmail_rec']['return_path']);
}

// set the recipient
$versionInformation = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Information\Typo3Version::class);
if ($versionInformation->getMajorVersion() === 10) {
$mailer->to($recipient);
} else {
$mailer->setTo($recipient);
}

// TODO: setContent should set the images (includeMedia) or add attachment
$this->setContent($mailer);

if ($this->encoding == 'base64') {
$mailer->setEncoder(\Swift_Encoding::getBase64Encoding());
}

if ($this->encoding == '8bit') {
$mailer->setEncoder(\Swift_Encoding::get8BitEncoding());
if ($versionInformation->getMajorVersion() < 10) {
if ($this->encoding == 'base64') {
$mailer->setEncoder(\Swift_Encoding::getBase64Encoding());
}
if ($this->encoding == '8bit') {
$mailer->setEncoder(\Swift_Encoding::get8BitEncoding());
}
}

$mailer->send();
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "azich/direct-mail",
"name": "directmailteam/direct-mail",
"type": "typo3-cms-extension",
"description": "Advanced Direct Mail/Newsletter mailer system with sophisticated options for personalization of emails including response statistics. Fork of kartolo/direct-mail.",
"keywords": [
Expand All @@ -22,7 +22,7 @@
"typo3/cms-core": "^10.3",
"friendsoftypo3/jumpurl": "^8.0",
"friendsoftypo3/tt-address": "^4.3 || ^5.0",
"friendsoftypo3/rdct": "dev-master"
"friendsoftypo3/rdct": "^2.0"
},
"require-dev": {
"roave/security-advisories": "dev-master"
Expand Down
2 changes: 1 addition & 1 deletion ext_emconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
'depends' => [
'tt_address' => '',
'php' => '7.2.0',
'typo3' => '9.5.0-9.5.99',
'typo3' => '9.5.0-10.4.99',
'rdct' => '1.0.0',
],
'conflicts' => [
Expand Down