mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-05 18:52:44 +01:00
commit
a7a5a90477
@ -42,19 +42,14 @@ class GmailTransport extends Transport
|
||||
|
||||
public function send(Swift_Mime_SimpleMessage $message, &$failedRecipients = null)
|
||||
{
|
||||
/* For some reason the Injected Mail class carries cached tokens, so we need to reinit the Mail class*/
|
||||
$this->gmail = null;
|
||||
$this->gmail = new Mail;
|
||||
|
||||
/*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);
|
||||
|
||||
@ -63,7 +58,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 +77,6 @@ class GmailTransport extends Transport
|
||||
|
||||
}
|
||||
|
||||
|
||||
$this->gmail->send();
|
||||
|
||||
$this->sendPerformed($message);
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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);
|
||||
});
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user