direct_mail
direct_mail copied to clipboard
Fetching plain_text Main - missing direct_mail boundaries (TYPO3 11, direct_mail 8.0.0.-alpha)
TYPO3 11.5.17 direct_mail 8.0.0-alpha PHP 7.4.30 User is Admin and has the rights for the install-tool. Both direct_mail static templates are included.
And another one:
Creating a new direct_mail Newsletter
selecting Direct Mail -> click on the storage folder with the plugin -> choose Internal Pages -> Create a new newsletter -> choose both Plain Text and HTML format
results in a Warning:
Check the following warning.
The plain text content does not contain any direct mail boundaries.
When trying to view the page with the type=99, it uses the configured template but gives no hint towards the boundaries.
elseif (!strstr($htmlmail->theParts['plain']['content'], '<!--DMAILER_SECTION_BOUNDARY')) {
$warningMsg[] = $lang->getLL('dmail_no_plain_boundaries');
}
@ineswillenbrock Can you see '<!--DMAILER_SECTION_BOUNDARY' in the HTML code?
@SSFGizmo yes, the HTML Version has the boundaries, only type=99 seems to have problems.
The correct plain text template-file is used, but includes only the static content and the date if one sends the mail. The HTML Mail includes the content of the newsletter-page.
could it be associated with https://github.com/kartolo/direct_mail/pull/310?
@ineswillenbrock could you check the latest develop
@kartolo I just tested the latest develop branch, even rebuilt the PHP autoload information: nothing changed. It still warns that plaintext does not contain any direct mail boundaries and sends the mail (obviously) without the content.
It seems like direct_mail 9.2.2 sends plain-text mails - the plain-text testmail contains the content of the newsletter-page. I did not check other versions.
@kartolo using elseif ($key == 'BEGIN')
on line 432 solves the problem.
https://github.com/kartolo/direct_mail/blob/dc7f7a206cbf074e803f0e0595ba06e001564405/Classes/Dmailer.php#L432
public function dmailer_getBoundaryParts($cArray, $userCategories)
{
$returnVal='';
$this->mailHasContent = false;
$boundaryMax = count($cArray)-1;
foreach ($cArray as $bKey => $cP) {
$key = substr($cP[0], 1);
$isSubscribed = false;
$cP['mediaList'] = $cP['mediaList'] ?? '';
if (!$key || (intval($userCategories) == -1)) {
$returnVal .= $cP[1];
$this->mediaList .= $cP['mediaList'];
if ($cP[1]) {
$this->mailHasContent = true;
}
} elseif ($key == 'END') {
$returnVal .= $cP[1];
$this->mediaList .= $cP['mediaList'];
// There is content and it is not just the header and footer content, or it is the only content because we have no direct mail boundaries.
if (($cP[1] && !($bKey == 0 || $bKey == $boundaryMax)) || count($cArray) == 1) {
$this->mailHasContent = true;
}
} else {
foreach (explode(',', $key) as $group) {
if (GeneralUtility::inList($userCategories, $group)) {
$isSubscribed = true;
}
}
if ($isSubscribed) {
$returnVal .= $cP[1];
$this->mediaList .= $cP['mediaList'];
$this->mailHasContent = true;
}
}
}
return $returnVal;
}