diff --git a/Mail/Message.php b/Mail/Message.php
index d2c321a..f986ed1 100644
--- a/Mail/Message.php
+++ b/Mail/Message.php
@@ -239,6 +239,7 @@ public function setReplyTo($replyToAddress)
*/
public function getRawMessage()
{
+ $this->setPartsToBody();
return $this->zendMessage->toString();
}
@@ -249,4 +250,4 @@ public function setMessageType($type)
{
return $this;
}
-}
\ No newline at end of file
+}
diff --git a/Model/MailEvent.php b/Model/MailEvent.php
index 2dda8e8..b2a2484 100644
--- a/Model/MailEvent.php
+++ b/Model/MailEvent.php
@@ -128,7 +128,6 @@ public function dispatch(Message $message)
foreach ($this->dataHelper->getBccTo($storeId) as $email) {
$message->addBcc(trim($email));
}
- $message->setPartsToBody();
}
$this->mail->setTemplateVars(null);
@@ -191,11 +190,13 @@ private function setPdfAttachment($emailType, Message $message, $obj)
private function setTACAttachment(Message $message, $tacPath)
{
list($filePath, $ext, $mimeType) = $this->getTacFile($tacPath);
+ $tacFilename = $this->dataHelper->getConfigGeneral('tac_filename');
+ $tacFilename = ((empty($tacFilename)) ? 'terms_and_conditions' : $tacFilename) . '.'. $ext;
if($this->dataHelper->versionCompare("2.3")) {
$attachment = new \Zend_Mime_Part(file_get_contents($filePath));
$attachment->type = $mimeType;
$attachment->disposition = \Zend_Mime::DISPOSITION_ATTACHMENT;
- $attachment->filename = 'terms_and_conditions.'. $ext;
+ $attachment->filename = $tacFilename;
return $attachment;
}
else{
@@ -204,7 +205,7 @@ private function setTACAttachment(Message $message, $tacPath)
$mimeType,
\Zend_Mime::DISPOSITION_ATTACHMENT,
\Zend_Mime::ENCODING_BASE64,
- 'terms_and_conditions.' . $ext
+ $tacFilename
);
}
}
diff --git a/etc/adminhtml/system.xml b/etc/adminhtml/system.xml
index 8461360..60ab93f 100644
--- a/etc/adminhtml/system.xml
+++ b/etc/adminhtml/system.xml
@@ -76,6 +76,10 @@
1
+
+
+ Basename for attachment
+
diff --git a/etc/config.xml b/etc/config.xml
index c50443d..f7505ed 100644
--- a/etc/config.xml
+++ b/etc/config.xml
@@ -28,6 +28,7 @@
1
+ terms_and_conditions