mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-08 08:24:39 -04:00
Bug fixes
This commit is contained in:
parent
1355bd4ecc
commit
478d435cf1
@ -9,10 +9,15 @@ class Mailer
|
|||||||
{
|
{
|
||||||
public function sendTo($toEmail, $fromEmail, $fromName, $subject, $view, $data = [])
|
public function sendTo($toEmail, $fromEmail, $fromName, $subject, $view, $data = [])
|
||||||
{
|
{
|
||||||
$views = [
|
// https://github.com/wildbit/laravel-postmark-provider/issues/2
|
||||||
'emails.'.$view.'_html',
|
if (isset($data['invoice_id']) && isset($_ENV['POSTMARK_API_TOKEN'])) {
|
||||||
'emails.'.$view.'_text',
|
$views = 'emails.'.$view.'_html';
|
||||||
];
|
} else {
|
||||||
|
$views = [
|
||||||
|
'emails.'.$view.'_html',
|
||||||
|
'emails.'.$view.'_text',
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Mail::send($views, $data, function ($message) use ($toEmail, $fromEmail, $fromName, $subject, $data) {
|
Mail::send($views, $data, function ($message) use ($toEmail, $fromEmail, $fromName, $subject, $data) {
|
||||||
@ -40,7 +45,7 @@ class Mailer
|
|||||||
return true;
|
return true;
|
||||||
} catch (Exception $exception) {
|
} catch (Exception $exception) {
|
||||||
Utils::logError('Email Error: ' . $exception->getMessage());
|
Utils::logError('Email Error: ' . $exception->getMessage());
|
||||||
if (isset($_ENV['POSTMARK_API_TOKEN'])) {
|
if (false && isset($_ENV['POSTMARK_API_TOKEN'])) {
|
||||||
$response = $exception->getResponse()->getBody()->getContents();
|
$response = $exception->getResponse()->getBody()->getContents();
|
||||||
$response = json_decode($response);
|
$response = json_decode($response);
|
||||||
return nl2br($response->Message);
|
return nl2br($response->Message);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user