diff --git a/application/libraries/service/MessageService/Email/Driver/Mail.php b/application/libraries/service/MessageService/Email/Driver/Mail.php index 8e04536..e461302 100755 --- a/application/libraries/service/MessageService/Email/Driver/Mail.php +++ b/application/libraries/service/MessageService/Email/Driver/Mail.php @@ -2,6 +2,7 @@ namespace service\MessageService\Email\Driver; use service\Utility\Logger; +use service\Utility\Command; class Mail { static function send (string $to, string $title, string $body) @@ -13,7 +14,17 @@ class Mail { $from = YAML_EMAIL_NAME . '<' . YAML_EMAIL_FROM . '>'; - $result = exec("export LANG=en_US.UTF-8 && echo -e '{$body}' | mail -r '{$from}' -s '{$title}' '{$to}' > /dev/null &"); + // $result = exec("export LANG=en_US.UTF-8 && echo -e '{$body}' | mail -r '{$from}' -s '{$title}' '{$to}' > /dev/null &"); + + $result = []; + Command::run([ + 'echo', '-e', Command::wrapArgument($body), '|', + 'mail', '-r', Command::wrapArgument($from), + '-s', Command::wrapArgument($title), Command::wrapArgument($to), + '> /dev/null &' + ], $result); + + $result = implode('', $result); Logger::Log( 'from:' . $from . ' Sent result:' . json_encode($result),