Add reply-to config setting

This commit is contained in:
snipe 2016-09-20 07:20:10 -07:00
parent 1e4e9dd3d7
commit bd5e6d8551
11 changed files with 50 additions and 5 deletions

View file

@ -31,6 +31,8 @@ MAIL_PASSWORD=YOURPASSWORD
MAIL_ENCRYPTION=null
MAIL_FROM_ADDR=you@example.com
MAIL_FROM_NAME='Snipe-IT'
MAIL_REPLYTO_ADDR=you@example.com
MAIL_REPLYTO_NAME='Snipe-IT'
# --------------------------------------------

View file

@ -100,16 +100,20 @@ class SendExpirationAlerts extends Command
if (count($expiring_assets) > 0) {
$this->info('Report sent to '.Setting::getSettings()->alert_email);
\Mail::send('emails.expiring-assets-report', $asset_data, function ($m) {
$m->to(explode(',', Setting::getSettings()->alert_email), Setting::getSettings()->site_name);
$m->replyTo(config('mail.reply_to.address'), config('mail.reply_to.name'));
$m->subject('Expiring Assets Report');
});
}
if (count($expiring_licenses) > 0) {
$this->info('Report sent to '.Setting::getSettings()->alert_email);
\Mail::send('emails.expiring-licenses-report', $license_data, function ($m) {
$m->to(explode(',', Setting::getSettings()->alert_email), Setting::getSettings()->site_name);
$m->replyTo(config('mail.reply_to.address'), config('mail.reply_to.name'));
$m->subject('Expiring Licenses Report');
});

View file

@ -50,6 +50,7 @@ class SendInventoryAlerts extends Command
if (count($data['data']) > 0) {
\Mail::send('emails.low-inventory', $data, function ($m) {
$m->to(explode(',', Setting::getSettings()->alert_email), Setting::getSettings()->site_name);
$m->replyTo(config('mail.reply_to.address'), config('mail.reply_to.name'));
$m->subject('Low Inventory Report');
});

View file

@ -365,6 +365,7 @@ class AccessoriesController extends Controller
Mail::send('emails.accept-accessory', $data, function ($m) use ($user) {
$m->to($user->email, $user->first_name . ' ' . $user->last_name);
$m->replyTo(config('mail.reply_to.address'), config('mail.reply_to.name'));
$m->subject('Confirm accessory delivery');
});
}
@ -483,6 +484,7 @@ class AccessoriesController extends Controller
Mail::send('emails.checkin-asset', $data, function ($m) use ($user) {
$m->to($user->email, $user->first_name . ' ' . $user->last_name);
$m->replyTo(config('mail.reply_to.address'), config('mail.reply_to.name'));
$m->subject('Confirm Accessory Checkin');
});
}

View file

@ -365,6 +365,7 @@ class ConsumablesController extends Controller
Mail::send('emails.accept-asset', $data, function ($m) use ($user) {
$m->to($user->email, $user->first_name . ' ' . $user->last_name);
$m->replyTo(config('mail.reply_to.address'), config('mail.reply_to.name'));
$m->subject('Confirm consumable delivery');
});
}

View file

@ -147,6 +147,7 @@ class SettingsController extends Controller
try {
Mail::send('emails.test', [], function ($m) {
$m->to(config('mail.from.address'), config('mail.from.name'));
$m->replyTo(config('mail.reply_to.address'), config('mail.reply_to.name'));
$m->subject('Test Email from Snipe-IT');
});
return 'success';
@ -199,6 +200,7 @@ class SettingsController extends Controller
if (Input::get('email_creds')=='1') {
Mail::send(['text' => 'emails.firstadmin'], $data, function ($m) use ($data) {
$m->to($data['email'], $data['first_name']);
$m->replyTo(config('mail.reply_to.address'), config('mail.reply_to.name'));
$m->subject('Your Snipe-IT credentials');
});
}

View file

@ -157,6 +157,7 @@ class UsersController extends Controller
Mail::send('emails.send-login', $data, function ($m) use ($user) {
$m->to($user->email, $user->first_name . ' ' . $user->last_name);
$m->replyTo(config('mail.reply_to.address'), config('mail.reply_to.name'));
$m->subject('Welcome ' . $user->first_name);
});
}
@ -209,6 +210,7 @@ class UsersController extends Controller
Mail::send('emails.send-login', $data, function ($m) use ($user) {
$m->to($user->email, $user->first_name . ' ' . $user->last_name);
$m->replyTo(config('mail.reply_to.address'), config('mail.reply_to.name'));
$m->subject('Welcome ' . $user->first_name);
});
}
@ -832,6 +834,7 @@ class UsersController extends Controller
if ($newuser['email']) {
Mail::send('emails.send-login', $data, function ($m) use ($newuser) {
$m->to($newuser['email'], $newuser['first_name'] . ' ' . $newuser['last_name']);
$m->replyTo(config('mail.reply_to.address'), config('mail.reply_to.name'));
$m->subject('Welcome ' . $newuser['first_name']);
});
}

View file

@ -126,6 +126,7 @@ class ViewAssetsController extends Controller
if (($settings->alert_email!='') && ($settings->alerts_enabled=='1') && (!config('app.lock_passwords'))) {
Mail::send('emails.asset-canceled', $data, function ($m) use ($user, $settings) {
$m->to(explode(',', $settings->alert_email), $settings->site_name);
$m->replyTo(config('mail.reply_to.address'), config('mail.reply_to.name'));
$m->subject('Item Request Canceled');
});
}
@ -159,6 +160,7 @@ class ViewAssetsController extends Controller
if (($settings->alert_email!='') && ($settings->alerts_enabled=='1') && (!config('app.lock_passwords'))) {
Mail::send('emails.asset-requested', $data, function ($m) use ($user, $settings) {
$m->to(explode(',', $settings->alert_email), $settings->site_name);
$m->replyTo(config('mail.reply_to.address'), config('mail.reply_to.name'));
$m->subject('Item Requested');
});
}
@ -222,6 +224,7 @@ class ViewAssetsController extends Controller
if (($settings->alert_email!='') && ($settings->alerts_enabled=='1') && (!config('app.lock_passwords'))) {
Mail::send('emails.asset-requested', $data, function ($m) use ($user, $settings) {
$m->to(explode(',', $settings->alert_email), $settings->site_name);
$m->replyTo(config('mail.reply_to.address'), config('mail.reply_to.name'));
$m->subject('Asset Requested');
});
}

View file

@ -152,6 +152,7 @@ class Asset extends Depreciable
\Mail::send('emails.accept-asset', $data, function ($m) use ($user) {
$m->to($user->email, $user->first_name . ' ' . $user->last_name);
$m->replyTo(config('mail.reply_to.address'), config('mail.reply_to.name'));
$m->subject('Confirm asset delivery');
});
}

View file

@ -3,6 +3,12 @@
return [
/*
| ***************************************************************************
| DO NOT MAKE CHANGES DIRECTLY TO THIS FILE.
|
| Instead use your .env file to set your application configuration settings.
| See https://snipe-it.readme.io/docs/configuration for more info.
|
|--------------------------------------------------------------------------
| Mail Driver
|--------------------------------------------------------------------------
@ -11,6 +17,7 @@ return [
| sending of e-mail. You may specify which one you're using throughout
| your application here. By default, Laravel is setup for SMTP mail.
|
|
| Supported: "smtp", "mail", "sendmail", "mailgun", "mandrill", "ses", "log"
|
*/
@ -56,6 +63,23 @@ return [
'from' => ['address' => env('MAIL_FROM_ADDR', null), 'name' => env('MAIL_FROM_NAME', null)],
/*
|--------------------------------------------------------------------------
| Global "Reply-To" Address
|--------------------------------------------------------------------------
|
| You may wish for all e-mails sent by your application to have a different "Reply-to"
| address than the "From" address. If this is left blank, the application will use
| your MAIL_FROM information.
|
*/
'reply_to' => [
'address' => env('MAIL_REPLYTO_ADDR', env('MAIL_FROM_ADDR', null)),
'name' => env('MAIL_REPLYTO_NAME', env('MAIL_FROM_NAME', null))
],
/*
|--------------------------------------------------------------------------
| E-Mail Encryption Protocol

View file

@ -14,6 +14,8 @@ MAIL_ENV_FROM_NAME=Brady Wetherington
MAIL_ENV_ENCRYPTION=tcp
MAIL_ENV_USERNAME=uberbrady@gmail.com
MAIL_ENV_PASSWORD=N7AqLufTZMULWHWYwJ0ZCw
MAIL_ENV_REPLYTO_ADDR=you@example.com
MAIL_ENV_REPLYTO_NAME='Snipe-IT'
#SNIPE-IT Variables
APP_ENV=develop