mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 21:22:58 +01:00
Fixes for sending via graph
This commit is contained in:
parent
a626858752
commit
164b8c41aa
@ -34,19 +34,19 @@ class Office365MailTransport extends AbstractTransport
|
||||
|
||||
$graph = new Graph();
|
||||
$token = $symfony_message->getHeaders()->get('GmailToken')->getValue();
|
||||
$message->getHeaders()->remove('GmailToken');
|
||||
$symfony_message->getHeaders()->remove('GmailToken');
|
||||
|
||||
$graph->setAccessToken($token);
|
||||
|
||||
try {
|
||||
$graphMessage = $graph->createRequest('POST', '/users/'.$this->getFrom().'/sendmail')
|
||||
$graphMessage = $graph->createRequest('POST', '/users/'.$symfony_message->getFrom()[0]->getAddress().'/sendmail')
|
||||
->attachBody(base64_encode($message->toString()))
|
||||
->addHeaders(['Content-Type' => 'text/plain'])
|
||||
->setReturnType(\Microsoft\Graph\Model\Message::class)
|
||||
->execute();
|
||||
} catch (\Exception $e) {
|
||||
sleep(5);
|
||||
$graphMessage = $graph->createRequest('POST', '/users/'.$this->getFrom().'/sendmail')
|
||||
$graphMessage = $graph->createRequest('POST', '/users/'.$symfony_message->getFrom()[0]->getAddress().'/sendmail')
|
||||
->attachBody(base64_encode($message->toString()))
|
||||
->addHeaders(['Content-Type' => 'text/plain'])
|
||||
->setReturnType(\Microsoft\Graph\Model\Message::class)
|
||||
@ -55,11 +55,6 @@ class Office365MailTransport extends AbstractTransport
|
||||
|
||||
}
|
||||
|
||||
private function getFrom()
|
||||
{
|
||||
return 'turbo124@outlook.com.au';
|
||||
}
|
||||
|
||||
private function base64_encode($data)
|
||||
{
|
||||
return rtrim(strtr(base64_encode($data), ['+' => '-', '/' => '_']), '=');
|
||||
|
Loading…
Reference in New Issue
Block a user