mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Enable looking up email status
This commit is contained in:
parent
041c89b4f8
commit
8d7eb709be
@ -273,4 +273,42 @@ class ClientController extends BaseController
|
|||||||
|
|
||||||
return view('clients.statement', $data);
|
return view('clients.statement', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getEmailHistory()
|
||||||
|
{
|
||||||
|
$str = '';
|
||||||
|
|
||||||
|
if (config('services.postmark')) {
|
||||||
|
$email = request()->email;
|
||||||
|
$account = auth()->user()->account;
|
||||||
|
$postmark = new \Postmark\PostmarkClient(config('services.postmark'));
|
||||||
|
$response = $postmark->getOutboundMessages(5, 0, $email, null, $account->account_key);
|
||||||
|
|
||||||
|
foreach ($response['messages'] as $message) {
|
||||||
|
$details = $postmark->getOutboundMessageDetails($message['MessageID']);
|
||||||
|
$str .= sprintf('<b>%s</b><br/>', $details['subject']);
|
||||||
|
|
||||||
|
if (count($details['messageevents'])) {
|
||||||
|
$event = $details['messageevents'][0];
|
||||||
|
$str .= sprintf('%s | %s<br/>', $event['Type'], $account->getDateTime($event['ReceivedAt'], true));
|
||||||
|
if ($message = $event['Details']['DeliveryMessage']) {
|
||||||
|
$str .= sprintf('<span class="text-muted">%s</span><br/>', $message);
|
||||||
|
}
|
||||||
|
if ($server = $event['Details']['DestinationServer']) {
|
||||||
|
$str .= sprintf('<span class="text-muted">%s</span><br/>', $server);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$str .= trans('texts.processing') . '...';
|
||||||
|
}
|
||||||
|
|
||||||
|
$str .= '<p/>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! $str) {
|
||||||
|
$str = trans('texts.no_messages_found');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $str;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -624,12 +624,12 @@ class Account extends Eloquent
|
|||||||
*
|
*
|
||||||
* @return DateTime|null|string
|
* @return DateTime|null|string
|
||||||
*/
|
*/
|
||||||
public function getDateTime($date = 'now')
|
public function getDateTime($date = 'now', $formatted = false)
|
||||||
{
|
{
|
||||||
$date = $this->getDate($date);
|
$date = $this->getDate($date);
|
||||||
$date->setTimeZone(new \DateTimeZone($this->getTimezone()));
|
$date->setTimeZone(new \DateTimeZone($this->getTimezone()));
|
||||||
|
|
||||||
return $date;
|
return $formatted ? $date->format($this->getCustomDateTimeFormat()) : $date;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -154,6 +154,10 @@ class Mailer
|
|||||||
$message['Bcc'] = $data['bccEmail'];
|
$message['Bcc'] = $data['bccEmail'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (! empty($data['account'])) {
|
||||||
|
$message['Tag'] = $data['account']->account_key;
|
||||||
|
}
|
||||||
|
|
||||||
$response = $client->sendEmailBatch([$message]);
|
$response = $client->sendEmailBatch([$message]);
|
||||||
if ($messageId = $response[0]->messageid) {
|
if ($messageId = $response[0]->messageid) {
|
||||||
return $this->handleSuccess($data, $messageId);
|
return $this->handleSuccess($data, $messageId);
|
||||||
|
@ -2746,6 +2746,10 @@ $LANG = array(
|
|||||||
'test' => 'Test',
|
'test' => 'Test',
|
||||||
'beta' => 'Beta',
|
'beta' => 'Beta',
|
||||||
'gmp_required' => 'Exporting to ZIP requires the GMP extension',
|
'gmp_required' => 'Exporting to ZIP requires the GMP extension',
|
||||||
|
'email_history' => 'Email History',
|
||||||
|
'loading' => 'Loading',
|
||||||
|
'no_messages_found' => 'No messages found',
|
||||||
|
'processing' => 'Processing',
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -170,7 +170,13 @@
|
|||||||
<b>{{ $contact->first_name.' '.$contact->last_name }}</b><br/>
|
<b>{{ $contact->first_name.' '.$contact->last_name }}</b><br/>
|
||||||
@endif
|
@endif
|
||||||
@if ($contact->email)
|
@if ($contact->email)
|
||||||
<i class="fa fa-envelope" style="width: 20px"></i>{!! HTML::mailto($contact->email, $contact->email) !!}<br/>
|
<i class="fa fa-envelope" style="width: 20px"></i>{!! HTML::mailto($contact->email, $contact->email) !!}
|
||||||
|
@if (config('services.postmark'))
|
||||||
|
| <a href="#" onclick="showEmailHistory('{{ $contact->email }}')">
|
||||||
|
{{ trans('texts.history') }}
|
||||||
|
</a>
|
||||||
|
@endif
|
||||||
|
<br/>
|
||||||
@endif
|
@endif
|
||||||
@if ($contact->phone)
|
@if ($contact->phone)
|
||||||
<i class="fa fa-phone" style="width: 20px"></i>{{ $contact->phone }}<br/>
|
<i class="fa fa-phone" style="width: 20px"></i>{{ $contact->phone }}<br/>
|
||||||
@ -313,6 +319,30 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="modal fade" id="emailHistoryModal" tabindex="-1" role="dialog" aria-labelledby="emailHistoryModalLabel" aria-hidden="true">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header">
|
||||||
|
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||||
|
<h4 class="modal-title" id="myModalLabel">{{ trans('texts.email_history') }}</h4>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="container" style="width: 100%; padding-bottom: 0px !important">
|
||||||
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-body">
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-footer" id="signUpFooter" style="margin-top: 0px">
|
||||||
|
<button type="button" class="btn btn-default" data-dismiss="modal">{{ trans('texts.close') }} </button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
|
||||||
var loadedTabs = {};
|
var loadedTabs = {};
|
||||||
@ -366,6 +396,14 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function showEmailHistory(email) {
|
||||||
|
$('#emailHistoryModal .panel-body').html("{{ trans('texts.loading') }}...");
|
||||||
|
$('#emailHistoryModal').modal('show');
|
||||||
|
$.post('{{ url('/email_history') }}', {email: email}, function(data) {
|
||||||
|
$('#emailHistoryModal .panel-body').html(data);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
@if ($client->showMap())
|
@if ($client->showMap())
|
||||||
function initialize() {
|
function initialize() {
|
||||||
var mapCanvas = document.getElementById('map');
|
var mapCanvas = document.getElementById('map');
|
||||||
|
@ -141,6 +141,7 @@ Route::group(['middleware' => ['lookup:user', 'auth:user']], function () {
|
|||||||
Route::get('settings/enable_two_factor', 'TwoFactorController@setupTwoFactor');
|
Route::get('settings/enable_two_factor', 'TwoFactorController@setupTwoFactor');
|
||||||
Route::post('settings/enable_two_factor', 'TwoFactorController@enableTwoFactor');
|
Route::post('settings/enable_two_factor', 'TwoFactorController@enableTwoFactor');
|
||||||
|
|
||||||
|
Route::post('email_history', 'ClientController@getEmailHistory');
|
||||||
Route::resource('clients', 'ClientController');
|
Route::resource('clients', 'ClientController');
|
||||||
Route::get('api/clients', 'ClientController@getDatatable');
|
Route::get('api/clients', 'ClientController@getDatatable');
|
||||||
Route::get('api/activities/{client_id?}', 'ActivityController@getDatatable');
|
Route::get('api/activities/{client_id?}', 'ActivityController@getDatatable');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user