mirror of
https://github.com/PGYER/codefever.git
synced 2026-05-06 21:50:39 +08:00
fix(email send driver): use Command Utility to run command
This commit is contained in:
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user