mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-08 12:12:48 +01:00
Add Mailgun API as mail driver
Add Mailgun API as a mail driver. Can be configured from the System Settings page.
This commit is contained in:
parent
cefa9db856
commit
5875b70496
@ -20,6 +20,9 @@ MAIL_FROM_ADDRESS
|
|||||||
MAIL_FROM_NAME
|
MAIL_FROM_NAME
|
||||||
MAIL_PASSWORD
|
MAIL_PASSWORD
|
||||||
|
|
||||||
|
MAILGUN_DOMAIN=
|
||||||
|
MAILGUN_SECRET=
|
||||||
|
|
||||||
#POSTMARK_API_TOKEN=
|
#POSTMARK_API_TOKEN=
|
||||||
|
|
||||||
PHANTOMJS_CLOUD_KEY='a-demo-key-with-low-quota-per-ip-address'
|
PHANTOMJS_CLOUD_KEY='a-demo-key-with-low-quota-per-ip-address'
|
||||||
|
@ -100,6 +100,8 @@ class AppController extends BaseController
|
|||||||
$_ENV['MAIL_FROM_NAME'] = $mail['from']['name'];
|
$_ENV['MAIL_FROM_NAME'] = $mail['from']['name'];
|
||||||
$_ENV['MAIL_PASSWORD'] = $mail['password'];
|
$_ENV['MAIL_PASSWORD'] = $mail['password'];
|
||||||
$_ENV['PHANTOMJS_CLOUD_KEY'] = 'a-demo-key-with-low-quota-per-ip-address';
|
$_ENV['PHANTOMJS_CLOUD_KEY'] = 'a-demo-key-with-low-quota-per-ip-address';
|
||||||
|
$_ENV['MAILGUN_DOMAIN'] = $mail['mailgun_domain'];
|
||||||
|
$_ENV['MAILGUN_SECRET'] = $mail['mailgun_secret'];
|
||||||
|
|
||||||
$config = '';
|
$config = '';
|
||||||
foreach ($_ENV as $key => $val) {
|
foreach ($_ENV as $key => $val) {
|
||||||
@ -174,6 +176,8 @@ class AppController extends BaseController
|
|||||||
$_ENV['MAIL_FROM_NAME'] = $mail['from']['name'];
|
$_ENV['MAIL_FROM_NAME'] = $mail['from']['name'];
|
||||||
$_ENV['MAIL_PASSWORD'] = $mail['password'];
|
$_ENV['MAIL_PASSWORD'] = $mail['password'];
|
||||||
$_ENV['MAIL_FROM_ADDRESS'] = $mail['username'];
|
$_ENV['MAIL_FROM_ADDRESS'] = $mail['username'];
|
||||||
|
$_ENV['MAILGUN_DOMAIN'] = $mail['mailgun_domain'];
|
||||||
|
$_ENV['MAILGUN_SECRET'] = $mail['mailgun_secret'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$config = '';
|
$config = '';
|
||||||
|
@ -80,7 +80,7 @@ return [
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'username' => env('MAIL_USERNAME'),
|
'username' => env('MAIL_USERNAME', ''),
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
@ -93,7 +93,7 @@ return [
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'password' => env('MAIL_PASSWORD'),
|
'password' => env('MAIL_PASSWORD', ''),
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
@ -17,8 +17,8 @@ return [
|
|||||||
'postmark' => env('POSTMARK_API_TOKEN', ''),
|
'postmark' => env('POSTMARK_API_TOKEN', ''),
|
||||||
|
|
||||||
'mailgun' => [
|
'mailgun' => [
|
||||||
'domain' => '',
|
'domain' => env('MAILGUN_DOMAIN',''),
|
||||||
'secret' => '',
|
'secret' => env('MAILGUN_SECRET',''),
|
||||||
],
|
],
|
||||||
|
|
||||||
'mandrill' => [
|
'mandrill' => [
|
||||||
|
@ -34,20 +34,28 @@
|
|||||||
<h3 class="panel-title">Email Settings</h3>
|
<h3 class="panel-title">Email Settings</h3>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body form-padding-right">
|
<div class="panel-body form-padding-right">
|
||||||
{!! Former::select('mail[driver]')->label('Driver')->options(['smtp' => 'SMTP', 'mail' => 'Mail', 'sendmail' => 'Sendmail'])
|
{!! Former::select('mail[driver]')->label('Driver')->options(['smtp' => 'SMTP', 'mail' => 'Mail', 'sendmail' => 'Sendmail', 'mailgun' => 'Mailgun'])
|
||||||
->value(isset($_ENV['MAIL_DRIVER']) ? $_ENV['MAIL_DRIVER'] : 'smtp') !!}
|
->value(isset($_ENV['MAIL_DRIVER']) ? $_ENV['MAIL_DRIVER'] : 'smtp')->setAttributes(['onchange' => 'mailDriverChange()']) !!}
|
||||||
{!! Former::text('mail[host]')->label('Host')
|
|
||||||
->value(isset($_ENV['MAIL_HOST']) ? $_ENV['MAIL_HOST'] : '') !!}
|
|
||||||
{!! Former::text('mail[port]')->label('Port')
|
|
||||||
->value(isset($_ENV['MAIL_PORT']) ? $_ENV['MAIL_PORT'] : '587') !!}
|
|
||||||
{!! Former::select('mail[encryption]')->label('Encryption')->options(['tls' => 'TLS', 'ssl' => 'SSL'])
|
|
||||||
->value(isset($_ENV['MAIL_ENCRYPTION']) ? $_ENV['MAIL_ENCRYPTION'] : 'tls') !!}
|
|
||||||
{!! Former::text('mail[from][name]')->label('From Name')
|
{!! Former::text('mail[from][name]')->label('From Name')
|
||||||
->value(isset($_ENV['MAIL_FROM_NAME']) ? $_ENV['MAIL_FROM_NAME'] : '') !!}
|
->value(isset($_ENV['MAIL_FROM_NAME']) ? $_ENV['MAIL_FROM_NAME'] : '') !!}
|
||||||
{!! Former::text('mail[username]')->label('Email')
|
{!! Former::text('mail[username]')->label('Email')
|
||||||
->value(isset($_ENV['MAIL_USERNAME']) ? $_ENV['MAIL_USERNAME'] : '') !!}
|
->value(isset($_ENV['MAIL_USERNAME']) ? $_ENV['MAIL_USERNAME'] : '') !!}
|
||||||
{!! Former::password('mail[password]')->label('Password')
|
<div id="standardMailSetup">
|
||||||
->value(isset($_ENV['MAIL_PASSWORD']) ? $_ENV['MAIL_PASSWORD'] : '') !!}
|
{!! Former::text('mail[host]')->label('Host')
|
||||||
|
->value(isset($_ENV['MAIL_HOST']) ? $_ENV['MAIL_HOST'] : '') !!}
|
||||||
|
{!! Former::text('mail[port]')->label('Port')
|
||||||
|
->value(isset($_ENV['MAIL_PORT']) ? $_ENV['MAIL_PORT'] : '587') !!}
|
||||||
|
{!! Former::select('mail[encryption]')->label('Encryption')->options(['tls' => 'TLS', 'ssl' => 'SSL'])
|
||||||
|
->value(isset($_ENV['MAIL_ENCRYPTION']) ? $_ENV['MAIL_ENCRYPTION'] : 'tls') !!}
|
||||||
|
{!! Former::password('mail[password]')->label('Password')
|
||||||
|
->value(isset($_ENV['MAIL_PASSWORD']) ? $_ENV['MAIL_PASSWORD'] : '') !!}
|
||||||
|
</div>
|
||||||
|
<div id="mailgunMailSetup">
|
||||||
|
{!! Former::text('mail[mailgun_domain]')->label('Mailgun Domain')
|
||||||
|
->value(isset($_ENV['MAILGUN_DOMAIN']) ? $_ENV['MAILGUN_DOMAIN'] : '') !!}
|
||||||
|
{!! Former::text('mail[mailgun_secret]')->label('Mailgun Private Key')
|
||||||
|
->value(isset($_ENV['MAILGUN_SECRET']) ? $_ENV['MAILGUN_SECRET'] : '') !!}
|
||||||
|
</div>
|
||||||
{{-- Former::actions( Button::primary('Send test email')->small()->withAttributes(['onclick' => 'testMail()']), ' <span id="mailTestResult"/>' ) --}}
|
{{-- Former::actions( Button::primary('Send test email')->small()->withAttributes(['onclick' => 'testMail()']), ' <span id="mailTestResult"/>' ) --}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -57,7 +65,8 @@
|
|||||||
|
|
||||||
var db_valid = false
|
var db_valid = false
|
||||||
var mail_valid = false
|
var mail_valid = false
|
||||||
|
mailDriverChange();
|
||||||
|
|
||||||
function testDatabase()
|
function testDatabase()
|
||||||
{
|
{
|
||||||
var data = $("form").serialize() + "&test=db";
|
var data = $("form").serialize() + "&test=db";
|
||||||
@ -78,6 +87,23 @@
|
|||||||
return db_valid;
|
return db_valid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function mailDriverChange() {
|
||||||
|
if ($("select[name='mail[driver]'").val() == 'mailgun') {
|
||||||
|
$("#standardMailSetup").hide();
|
||||||
|
$("#standardMailSetup").children('select,input').prop('disabled',true);
|
||||||
|
$("#mailgunMailSetup").show();
|
||||||
|
$("#mailgunMailSetup").children('select,input').prop('disabled',false);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$("#standardMailSetup").show();
|
||||||
|
$("#standardMailSetup").children('select,input').prop('disabled',false);
|
||||||
|
|
||||||
|
$("#mailgunMailSetup").hide();
|
||||||
|
$("#mailgunMailSetup").children('select,input').prop('disabled',true);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function testMail()
|
function testMail()
|
||||||
{
|
{
|
||||||
var data = $("form").serialize() + "&test=mail";
|
var data = $("form").serialize() + "&test=mail";
|
||||||
|
Loading…
Reference in New Issue
Block a user