"; // 2. Apply the other fields. foreach ($mailParams as $key => $value) { if (empty($value)) { continue; } switch ($key) { case 'text': $message->setTxtBody($mailParams['text']); break; case 'html': $message->setHTMLBody($mailParams['html']); break; case 'attachments': foreach ($mailParams['attachments'] as $fileID => $attach) { $message->addAttachment($attach['fullPath'], $attach['mime_type'], $attach['cleanName'] ); } break; case 'headers': $message->headers($value); break; default: $message->headers(array($key => $value), TRUE); } } \CRM_Utils_Mail::setMimeParams($message); return $message; } }