Php 从Laravel应用程序发送的电子邮件使用noreply而不是应用程序名称
我正在使用此功能从我的laravel应用程序发送电子邮件,但电子邮件将以Php 从Laravel应用程序发送的电子邮件使用noreply而不是应用程序名称,php,laravel,email,Php,Laravel,Email,我正在使用此功能从我的laravel应用程序发送电子邮件,但电子邮件将以noreply作为发件人的名称,而不是mail.php文件中设置的APP name。可以采取什么措施使电子邮件以应用程序名称而不是noreply名称发送 $sender\u name=“我的应用程序名称”; 配置: {"name":"smtp","host":"mail.mydomain.com","port":"5
noreply
作为发件人的名称,而不是mail.php文件中设置的APP name
。可以采取什么措施使电子邮件以应用程序名称而不是noreply
名称发送
$sender\u name=“我的应用程序名称”;
配置:
{"name":"smtp","host":"mail.mydomain.com","port":"587","enc":"tls","username":"noreply@mydomain.com","password":"mypassword","driver":"smtp"}
mail.php:
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'noreply@mydomain.com'),
'name' => env('MAIL_FROM_NAME', 'App Name'),
],
helper.php
:
function send_smtp_mail($config, $receiver_email, $receiver_name, $sender_email, $sender_name, $subject, $message)
{
$f = fsockopen($config->host, $config->port);
if ($f !== false) {
$res = fread($f, 1024);
if (strlen($res) > 0 && strpos($res, '220') === 0) {
$mail_val = [
'send_to_name' => $receiver_name,
'send_to' => $receiver_email,
'email_from' => $sender_email,
'email_from_name' => $sender_name,
'subject' => $subject,
];
Config::set('mail.driver', $config->driver);
Config::set('mail.from', $config->username);
Config::set('mail.name', $sender_name);
Config::set('mail.host', $config->host);
Config::set('mail.port', $config->port);
Config::set('mail.username', $config->username);
Config::set('mail.password', $config->password);
Config::set('mail.encryption', $config->enc);
$xx = Mail::send('partials.email', ['body' => $message], function ($send) use ($mail_val) {
$send->from($mail_val['email_from'], $mail_val['email_from_name']);
$send->replyto($mail_val['email_from'], $mail_val['email_from_name']);
$send->to($mail_val['send_to'], $mail_val['send_to_name'])->subject($mail_val['subject']);
});
}
}
}
是否检查了.env文件中的值?