mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
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:
@@ -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()
|
||||||
|
@@ -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()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user