When sending email alerts use CRLF for windows clients (#10563)

* When sending email alerts use CRLF for windows clients

* Convert hard \r\n into line return in templates

* there is no down really
This commit is contained in:
Tony Murray
2019-10-02 14:08:10 +00:00
committed by GitHub
parent c8bcdbb916
commit 7482422614
2 changed files with 32 additions and 6 deletions

View File

@@ -35,12 +35,10 @@ class Mail extends Transport
public function contactMail($obj) public function contactMail($obj)
{ {
if (empty($this->config['email'])) { $email = $this->config['email'] ?? $obj['contacts'];
$email = $obj['contacts']; $msg = preg_replace("/(?<!\r)\n/", "\r\n", $obj['msg']); // fix line returns for windows mail clients
} else {
$email = $this->config['email']; return send_mail($email, $obj['title'], $msg, (Config::get('email_html') == 'true') ? true : false);
}
return send_mail($email, $obj['title'], $obj['msg'], (Config::get('email_html') == 'true') ? true : false);
} }
public static function configTemplate() public static function configTemplate()

View File

@@ -0,0 +1,28 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class FixTemplateLinefeeds extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
DB::table('alert_templates')->update(['template' => DB::raw('REPLACE(`template`, \'\\\\r\\\\n\', char(10))')]);
DB::table('alert_templates')->update(['template' => DB::raw('REPLACE(`template`, \'\\\\n\', \'\')')]);
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
}
}