Skip to content

Commit

Permalink
Always send html version and plain text
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel Passarelli committed Nov 17, 2015
1 parent aa9f39a commit 3e6ba93
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/MailGateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,21 +204,20 @@ protected function configureSender(&$emailProperties, &$email)
protected function processEmailProperties($to, $message)
{
// If the notification is only a string, create it a email as the notification being the subject of the email
if(!is_array($message)){
$original_message = $message;
$original_message = $message;
if(!is_array($original_message)){
$message = array(
// Remove HTML tags and trim it to a max length of 75.
'subject' => substr(strip_tags($original_message),0,75).'...',
'body' => $original_message,
);
}
// Checks if the user passed only a string for the body of the email.
if(!is_array($message['body'])){
$message['body'] = array(
'html' => $message['body'],
'plain' => Html2Text::convert($message['body']),
);
//Checks is the message is a HTML message, and generate the plain text version of it.
if($this->isHtml($original_message)) {
$message['body'] = array(
'html' => $original_message,
'plain' => Html2Text::convert($original_message),
);
} else {
$message['body'] = $original_message;
}
}

// Merge and Overwrite configurations.
Expand Down Expand Up @@ -260,6 +259,7 @@ protected function handleEmailBodyProperties($message)
$this->isHtml($emailBodyProperties['body'])
){
$emailBodyProperties['contentType'] = 'text/html';

}
}

Expand Down

0 comments on commit 3e6ba93

Please sign in to comment.