1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

Fixes for multi-mailer gmail implementation

This commit is contained in:
David Bomba 2021-02-17 13:20:25 +11:00
parent 0985363280
commit 76f57387dc
3 changed files with 2 additions and 25 deletions

View File

@ -45,17 +45,10 @@ class GmailTransport extends Transport
/*We should nest the token in the message and then discard it as needed*/
$token = $message->getHeaders()->get('GmailToken')->getValue();
$user_id = $message->getHeaders()->get('UserId')->getValue();
LaravelGmail::setUserId($user_id);
nlog("gmail transporter token = {$token}");
$message->getHeaders()->remove('GmailToken');
$message->getHeaders()->remove('UserId');
nlog("inside gmail sender with token {$token}");
$this->beforeSendPerformed($message);
$this->gmail->using($token);
@ -63,7 +56,7 @@ class GmailTransport extends Transport
$this->gmail->from($message->getFrom());
$this->gmail->subject($message->getSubject());
$this->gmail->message($message->getBody());
//$this->gmail->message($message->toString());
$this->gmail->cc($message->getCc());
$this->gmail->bcc($message->getBcc());
@ -82,7 +75,6 @@ class GmailTransport extends Transport
}
$this->gmail->send();
$this->sendPerformed($message);

View File

@ -116,19 +116,6 @@ class EmailEntity implements ShouldQueue
NinjaMailerJob::dispatch($nmo);
// try {
// Mail::to($this->invitation->contact->email, $this->invitation->contact->present()->name())
// ->send(
// new TemplateEmail(
// $this->email_entity_builder,
// $this->invitation->contact
// )
// );
// } catch (\Exception $e) {
// $this->entityEmailFailed($e->getMessage());
// $this->logMailError($e->getMessage(), $this->entity->client);
// }
/* Mark entity sent */
$this->entity->service()->markSent()->save();
}

View File

@ -153,14 +153,12 @@ class NinjaMailerJob implements ShouldQueue
(new MailServiceProvider(app()))->register();
$token = $user->oauth_user_token->access_token;
$user_id = $user->oauth_user_id;
$this->nmo
->mailable
->from($user->email, $user->present()->name())
->withSwiftMessage(function ($message) use($token, $user_id) {
->withSwiftMessage(function ($message) use($token) {
$message->getHeaders()->addTextHeader('GmailToken', $token);
$message->getHeaders()->addTextHeader('UserId', $user_id);
});
}