Skip to content
Snippets Groups Projects
Commit f3b037af authored by Torsten Oppermann's avatar Torsten Oppermann
Browse files

[TASK] Validation of cc & bcc mails

parent bcb3d416
No related branches found
No related tags found
1 merge request!3New version 4 1
......@@ -203,6 +203,35 @@ class MailController extends ActionController {
* @throws \TYPO3\CMS\Extbase\Persistence\Exception\UnknownObjectException
*/
public function sendTestMailAction(array $parameters = []) {
foreach ($parameters['templates'] as $parameter) {
$ccAddresses = GeneralUtility::trimExplode(',', $parameter['cc']);
if (count($ccAddresses) > 0) {
foreach ($ccAddresses as $ccAddress) {
if (!filter_var($ccAddress, FILTER_VALIDATE_EMAIL) && trim($ccAddress) !== '') {
$message = LocalizationUtility::translate('backend.error_cc', 'sg_mail');
$this->addFlashMessage($message, '', FlashMessage::WARNING);
$arguments = $this->request->getArguments();
$this->redirect('index', NULL, NULL, $arguments);
}
}
}
$bccAddresses = GeneralUtility::trimExplode(',', $parameter['bcc']);
if (count($bccAddresses) > 0) {
foreach ($bccAddresses as $bccAddress) {
if (!filter_var($bccAddress, FILTER_VALIDATE_EMAIL) && trim($bccAddress) !== '') {
$message = LocalizationUtility::translate('backend.error_bcc', 'sg_mail');
$this->addFlashMessage($message, '', FlashMessage::WARNING);
$arguments = $this->request->getArguments();
$this->redirect('index', NULL, NULL, $arguments);
}
}
}
}
foreach ($parameters['templates'] as $key => $template) {
BackendService::saveTemplate(
(int) GeneralUtility::_GP('id'), $parameters['selectedExtension'], $parameters['selectedTemplate'],
......
......@@ -49,6 +49,14 @@
<source>Queue Entry Date</source>
<target>Erstellungsdatum</target>
</trans-unit>
<trans-unit id="backend.error_bcc" approved="yes">
<source>The bcc addresses are invalid</source>
<target>Ungültige bcc Adressen</target>
</trans-unit>
<trans-unit id="backend.error_cc" approved="yes">
<source>The cc addresses are invalid</source>
<target>Ungültige cc Adressen</target>
</trans-unit>
<trans-unit id="backend.failure_mail" approved="yes">
<source>There was an error when sending the preview email. Please check your configuration.</source>
<target>Ein Fehler ist aufgetreten. Bitte überprüfen Sie die Konfiguration.</target>
......
......@@ -39,6 +39,12 @@
<trans-unit id="backend.entry_date">
<source>Queue Entry Date</source>
</trans-unit>
<trans-unit id="backend.error_bcc">
<source>The bcc addresses are invalid</source>
</trans-unit>
<trans-unit id="backend.error_cc">
<source>The cc addresses are invalid</source>
</trans-unit>
<trans-unit id="backend.failure_mail">
<source>There was an error when sending the preview email. Please check your configuration.</source>
</trans-unit>
......
......@@ -28,50 +28,57 @@
<tbody>
<f:for each="{paginatedMails}" as="mail">
{sgm:backend.editOnClick(table: 'tx_sgmail_domain_model_mail', uid: mail.uid) -> sgm:set(name: 'editOnClick') -> f:format.raw()}
<tr data-uid="{mail.uid}">
<td nowrap="nowrap" class="col-icon">
<f:format.raw>
<sgm:backend.icon table="tx_sgmail_domain_model_mail" row="{mail}" />
</f:format.raw>
</td>
<td>
<span>{mail.from_address}</span>
<br>
<span>{mail.to_address}</span>
</td>
<td>
<span><f:format.crop maxCharacters="40" append="...">{mail.mail_subject}</f:format.crop></span>
</td>
<td>
<span><f:format.date format="d.m.Y h:i">{mail.crdate}</f:format.date></span>
<br>
<f:if condition="{mail.last_sending_time} != 0">
<span><f:format.date format="d.m.Y h:i">{mail.last_sending_time}</f:format.date></span>
</f:if>
</td>
<td nowrap="nowrap" class="col-control">
<f:format.raw>
<sgm:backend.control table="tx_sgmail_domain_model_mail" row="{mail}" />
</f:format.raw>
</td>
<td>
<f:link.action class="btn btn-default btn-send-now" controller="Queue" action="sendMail" arguments="{uid: mail.uid, selectedTemplate: selectedTemplateKey, selectedExtension: selectedExtensionKey}">
<f:if condition="{mail.sent}">
<f:then>
<tr data-uid="{mail.uid}">
</f:then>
<f:else>
<tr data-uid="{mail.uid}" style="background-color: #C8C8C8;">
</f:else>
</f:if>
<td nowrap="nowrap" class="col-icon">
<f:format.raw>
<sgm:backend.icon table="tx_sgmail_domain_model_mail" row="{mail}" />
</f:format.raw>
</td>
<td>
<span>{mail.from_address}</span>
<br>
<span>{mail.to_address}</span>
</td>
<td>
<span><f:format.crop maxCharacters="40" append="...">{mail.mail_subject}</f:format.crop></span>
</td>
<td>
<span><f:format.date format="d.m.Y h:i">{mail.crdate}</f:format.date></span>
<br>
<f:if condition="{mail.last_sending_time} != 0">
<span><f:format.date format="d.m.Y h:i">{mail.last_sending_time}</f:format.date></span>
</f:if>
</td>
<td nowrap="nowrap" class="col-control">
<f:format.raw>
<sgm:backend.control table="tx_sgmail_domain_model_mail" row="{mail}" />
</f:format.raw>
</td>
<td>
<f:link.action class="btn btn-default btn-send-now" controller="Queue" action="sendMail" arguments="{uid: mail.uid, selectedTemplate: selectedTemplateKey, selectedExtension: selectedExtensionKey}">
<span class="t3js-icon icon icon-size-small icon-state-default actions-document-import-t3d">
<span class="icon-markup">
<img src="/typo3/sysext/core/Resources/Public/Icons/T3Icons/actions/actions-document-import-t3d.svg" width="16" height="16">
</span>
</span>
<f:translate key="backend.send_now" />
</f:link.action>
<a class="btn btn-default btn-toggle" data-uid="{mail.uid}">
<f:translate key="backend.send_now" />
</f:link.action>
<a class="btn btn-default btn-toggle" data-uid="{mail.uid}">
<span class="t3js-icon icon icon-size-small icon-state-default actions-document-view">
<span class="icon-markup">
<img src="/typo3/sysext/core/Resources/Public/Icons/T3Icons/actions/actions-document-view.svg" width="16" height="16">
</span>
</span>
<f:translate key="backend.showBody" />
</a>
</td>
<f:translate key="backend.showBody" />
</a>
</td>
</tr><!-- Modal -->
<div class="modal fade" id="toggle-{mail.uid}" tabindex="-1" role="dialog" aria-labelledby="login-modal-label">
<div class="modal-dialog" role="document">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment