foreach($structure->parts as $p) {
switch($p->ctype_primary .'/'. $p->ctype_secondary ) {
case 'text/plain':
- $bodytext = $p->body;
- break;
+ $bodytext = $p->body;
+ break;
- case 'text/html':
- $bodyhtml = $p->body;
- break;
- // no default...
+ case 'text/html':
+ $bodyhtml = $p->body;
+ break;
+ // no default...
}
-
+
}
break;
case 'text/plain':
$cc =clone($cm);
$cm->setFrom(array(
- 'bodytext' => !empty($opts['use-file']) ? '' : $parts[2],
- 'plaintext' => '',
+ 'bodytext' => $bodyhtml,
+ 'plaintext' => $bodytext,
'updated_dt' => date('Y-m-d H:i:s'),
'use_file' => !empty($opts['use-file']) ? realpath($opts['file']) : '',
));
'from_email' => $from_email,
'subject' => $headers['Subject'],
'name' => $template_name,
- 'bodytext' => !empty($opts['use-file']) ? '' : $parts[2],
+ 'bodytext' => $bodyhtml,
+ 'plaintext' => $bodytext,
'updated_dt' => date('Y-m-d H:i:s'),
'created_dt' => date('Y-m-d H:i:s'),
'use_file' => !empty($opts['use-file']) ? realpath($opts['file']) : '',