1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-11 05:32:39 +01:00
invoiceninja/app/Helpers/Mail/GmailTransportConfig.php
David Bomba 4bc92a7aa1
Stub GMail Driver (#3099)
* fix for blank client settings

* Force all custom fields to strings

* Fixes for bulk actions

* Fixes for company POST route..

* Change text from Bitcoin to CRYPTO

* Implement default_gateway_type_id in transformer

* use scopes for company filtering

* Implement validation for portal_domain

* Add Google API client

* Add activities to company transformer
2019-11-27 20:47:59 +11:00

77 lines
1.5 KiB
PHP

<?php
/**
* Invoice Ninja (https://invoiceninja.com)
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2019. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://opensource.org/licenses/AAL
*/
namespace App\Helpers\Mail;
use App\Models\User;
use Illuminate\Support\Facades\Mail;
/**
* GmailTransportConfig
*/
class GmailTransportConfig
{
public function __invoke(User $user)
{
// $transport = (new Swift_SmtpTransport('smtp.googlemail.com', 465, 'ssl'))
// ->setUsername('YOUR_GMAIL_USERNAME')
// ->setPassword('YOUR_GMAIL_PASSWORD')
// ;
//
// $transport = \Swift_SmtpTransport::newInstance($host, $port);
// set encryption
if (isset($encryption)) $transport->setEncryption($encryption);
// set username and password
if (isset($username))
{
$transport->setUsername($username);
$transport->setPassword($password);
}
//
//
// // Create the Transport
// // Create the Mailer using your created Transport
// $mailer = new Swift_Mailer($transport);
/********************* We may need to fetch a new token on behalf of the client ******************************/
$transport = (new Swift_SmtpTransport('smtp.gmail.com', 587, 'tls'))
->setAuthMode('XOAUTH2')
->setUsername('turbo124@gmail.com')
->setPassword('');
// set new swift mailer
Mail::setSwiftMailer(new \Swift_Mailer($transport));
Mail::to('david@romulus.com.au')
->send('test');
}
}