Specify reply-to header #1083

This commit is contained in:
Hillel Coren 2017-03-30 15:49:30 +03:00
parent c808681ec3
commit ec46107dba
7 changed files with 25 additions and 11 deletions

View File

@ -173,6 +173,7 @@ class Account extends Eloquent
'payment_type_id', 'payment_type_id',
'gateway_fee_enabled', 'gateway_fee_enabled',
'reset_counter_date', 'reset_counter_date',
'reply_to_email',
]; ];
/** /**

View File

@ -199,7 +199,7 @@ class ContactMailer extends Mailer
} }
$subject = $this->templateService->processVariables($subject, $variables); $subject = $this->templateService->processVariables($subject, $variables);
$fromEmail = $user->email; $fromEmail = $account->reply_to_email ?: $user->email;
$view = $account->getTemplateView(ENTITY_INVOICE); $view = $account->getTemplateView(ENTITY_INVOICE);
$response = $this->sendTo($invitation->contact->email, $fromEmail, $account->getDisplayName(), $subject, $view, $data); $response = $this->sendTo($invitation->contact->email, $fromEmail, $account->getDisplayName(), $subject, $view, $data);
@ -291,9 +291,10 @@ class ContactMailer extends Mailer
$data['invoice_id'] = $payment->invoice->id; $data['invoice_id'] = $payment->invoice->id;
$view = $account->getTemplateView('payment_confirmation'); $view = $account->getTemplateView('payment_confirmation');
$fromEmail = $account->reply_to_email ?: $user->email;
if ($user->email && $contact->email) { if ($user->email && $contact->email) {
$this->sendTo($contact->email, $user->email, $accountName, $subject, $view, $data); $this->sendTo($contact->email, $fromEmail, $accountName, $subject, $view, $data);
} }
$account->loadLocalizationSettings(); $account->loadLocalizationSettings();

View File

@ -265,6 +265,7 @@ class AccountTransformer extends EntityTransformer
'payment_type_id' => (int) $account->payment_type_id, 'payment_type_id' => (int) $account->payment_type_id,
'gateway_fee_enabled' => (bool) $account->gateway_fee_enabled, 'gateway_fee_enabled' => (bool) $account->gateway_fee_enabled,
'reset_counter_date' => $account->reset_counter_date, 'reset_counter_date' => $account->reset_counter_date,
'reply_to_email' => $account->reply_to_email,
]; ];
} }
} }

View File

@ -24,6 +24,7 @@ class AddGatewayFeeLocation extends Migration
} }
$table->boolean('gateway_fee_enabled')->default(0); $table->boolean('gateway_fee_enabled')->default(0);
$table->date('reset_counter_date')->nullable(); $table->date('reset_counter_date')->nullable();
$table->string('reply_to_email')->nullable();
}); });
Schema::table('clients', function ($table) { Schema::table('clients', function ($table) {
@ -52,6 +53,7 @@ class AddGatewayFeeLocation extends Migration
Schema::table('accounts', function ($table) { Schema::table('accounts', function ($table) {
$table->dropColumn('gateway_fee_enabled'); $table->dropColumn('gateway_fee_enabled');
$table->dropColumn('reset_counter_date'); $table->dropColumn('reset_counter_date');
$table->dropColumn('reply_to_email');
}); });
Schema::table('clients', function ($table) { Schema::table('clients', function ($table) {

File diff suppressed because one or more lines are too long

View File

@ -2307,7 +2307,6 @@ $LANG = array(
'notes_reminder2' => 'Second Reminder', 'notes_reminder2' => 'Second Reminder',
'notes_reminder3' => 'Third Reminder', 'notes_reminder3' => 'Third Reminder',
'bcc_email' => 'BCC Email', 'bcc_email' => 'BCC Email',
'bcc_email_help' => 'All emails sent to your clients will also be sent to this address.',
'tax_quote' => 'Tax Quote', 'tax_quote' => 'Tax Quote',
'tax_invoice' => 'Tax Invoice', 'tax_invoice' => 'Tax Invoice',
'emailed_invoices' => 'Successfully emailed invoices', 'emailed_invoices' => 'Successfully emailed invoices',
@ -2458,6 +2457,9 @@ $LANG = array(
'purge_data_message' => 'Warning: This will permanently erase your data, there is no undo.', 'purge_data_message' => 'Warning: This will permanently erase your data, there is no undo.',
'contact_phone' => 'Contact Phone', 'contact_phone' => 'Contact Phone',
'contact_email' => 'Contact Email', 'contact_email' => 'Contact Email',
'reply_to_email' => 'Reply-To Email',
'reply_to_email_help' => 'Specify the reply-to address for client emails.',
'bcc_email_help' => 'Privately include this address with client emails.',
); );

View File

@ -19,6 +19,7 @@
{!! Former::open()->rules([ {!! Former::open()->rules([
'bcc_email' => 'email', 'bcc_email' => 'email',
'reply_to_email' => 'email',
])->addClass('warn-on-exit') !!} ])->addClass('warn-on-exit') !!}
{{ Former::populate($account) }} {{ Former::populate($account) }}
@ -32,6 +33,15 @@
</div> </div>
<div class="panel-body form-padding-right"> <div class="panel-body form-padding-right">
{!! Former::text('reply_to_email')
->placeholder(Auth::user()->registered ? Auth::user()->email : ' ')
->help('reply_to_email_help') !!}
{!! Former::text('bcc_email')
->help('bcc_email_help') !!}
&nbsp;
{!! Former::checkbox('pdf_email_attachment') {!! Former::checkbox('pdf_email_attachment')
->text(trans('texts.enable')) ->text(trans('texts.enable'))
->value(1) ->value(1)
@ -46,10 +56,6 @@
&nbsp; &nbsp;
{!! Former::text('bcc_email')->help('bcc_email_help') !!}
&nbsp;
{{-- Former::select('recurring_hour')->options($recurringHours) --}} {{-- Former::select('recurring_hour')->options($recurringHours) --}}
</div> </div>