Skip to content

Commit

Permalink
fix: Base64 decoding failure when sending messages via gmail
Browse files Browse the repository at this point in the history
  • Loading branch information
Wisdom Ebong committed Jul 6, 2021
1 parent a09abbe commit 7cdc30b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/GmailSource.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ public function send($to, $message, $title = '', $contact_type = null)
try {
$response = $mailer->createMessage($title, $from, $to, $message)->send();
if (!isset($response->id)) {
app('log')->error("Twitter: Send failed", ['response' => $response]);
app('log')->error("Gmail: Send failed", ['response' => $response]);
return [MessageStatus::FAILED, false];
}
return [MessageStatus::SENT, $response->id];
Expand Down
6 changes: 4 additions & 2 deletions src/Services/Mailer.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,10 @@ public function createMessage($subject = '', $from = '', $to = '', $body = '')
*/
public function setMessage($message)
{
$this->mime = (new Swift_Mime_ContentEncoder_Base64ContentEncoder)
->encodeString($message->toString());
// $this->mime = (new Swift_Mime_ContentEncoder_Base64ContentEncoder)
// ->encodeString($message->toString());

$this->mime = base64_encode($message->toString());

return $this;
}
Expand Down

0 comments on commit 7cdc30b

Please sign in to comment.