replaceImages => true|false,
locale => 'en' .... or zh_hk....
rcpts => array() // override recipients..
+ attachments => array(
+ array(
+ file:
+ name : (optional) - uses basename of file
+ mimetype :
+ ),
+ ......
+
]
*
* recipents is gathered from the resulting template
// print_r($parts);exit;
if($this->attachments){
//if got a attachments
+ $contentType = 'Content-Type: text/plain; charset=utf-8';
if (isset($parts[1]['Content-Type'])) {
+ $contentType = $parts[1]['Content-Type'];
unset($parts[1]['Content-Type']);
}
$random_hash = md5(date('r', time()));
Content-Type: multipart/alternative; boundary=alt-$random_hash
--alt-$random_hash
+Content-Type: $contentType
+
{$parts[2]}
--alt-$random_hash--
---mixed-$random_hash
-Content-Type: {$this->attachments[0]['mimetype']}; name=\"{$this->attachments[0]['name']}\"
-Content-Transfer-Encoding: base64
-Content-Disposition: attachment
-
-{$this->attachments[0]['file']}
+";
+foreach($this->attachments as $attch){
+$str .= "
--mixed-$random_hash
-Content-Type: {$this->attachments[0]['mimetype']}; name=\"{$this->attachments[0]['name']}\"
-Content-Transfer-Encoding: base64
+Content-Type: {$attch['mimetype']}; ".
+((empty($attch['name'])) ? '' : "name=\"{$attch['name']}\"") .
+"Content-Transfer-Encoding: base64
Content-Disposition: attachment
-{$this->attachments[0]['file']}
---mixed-$random_hash--
+{$attch['file']}
";
+}
+ $str .= "--mixed-$random_hash--";
$parts[2] = $str;
// --mixed-{t.random_hash}