mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 17:05:42 +02:00
MINOR: New email object for each recipient
Creating a new email object for each recipient so that no state from the previous email object is carried through. Fixes silverstripe/silverstripe-userforms#356.
This commit is contained in:
parent
cc7a674a7a
commit
5f5cedb3d1
@ -662,22 +662,23 @@ JS
|
|||||||
|
|
||||||
// email users on submit.
|
// email users on submit.
|
||||||
if($recipients = $this->FilteredEmailRecipients($data, $form)) {
|
if($recipients = $this->FilteredEmailRecipients($data, $form)) {
|
||||||
$email = new UserFormRecipientEmail($submittedFields);
|
|
||||||
$mergeFields = $this->getMergeFieldsMap($emailData['Fields']);
|
|
||||||
|
|
||||||
if($attachments) {
|
|
||||||
foreach($attachments as $file) {
|
|
||||||
if($file->ID != 0) {
|
|
||||||
$email->attachFile(
|
|
||||||
$file->Filename,
|
|
||||||
$file->Filename,
|
|
||||||
HTTP::get_mime_type($file->Filename)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach($recipients as $recipient) {
|
foreach($recipients as $recipient) {
|
||||||
|
$email = new UserFormRecipientEmail($submittedFields);
|
||||||
|
$mergeFields = $this->getMergeFieldsMap($emailData['Fields']);
|
||||||
|
|
||||||
|
if($attachments) {
|
||||||
|
foreach($attachments as $file) {
|
||||||
|
if($file->ID != 0) {
|
||||||
|
$email->attachFile(
|
||||||
|
$file->Filename,
|
||||||
|
$file->Filename,
|
||||||
|
HTTP::get_mime_type($file->Filename)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$parsedBody = SSViewer::execute_string($recipient->getEmailBodyContent(), $mergeFields);
|
$parsedBody = SSViewer::execute_string($recipient->getEmailBodyContent(), $mergeFields);
|
||||||
|
|
||||||
if (!$recipient->SendPlain && $recipient->emailTemplateExists()) {
|
if (!$recipient->SendPlain && $recipient->emailTemplateExists()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user