ฉันกำหนดค่าเว็บไซต์ให้ส่งอีเมลผ่าน SMTP ของ Gmail เว็บไซต์ของฉันทำงานใน laravel - 4 framework ด้านล่างนี้เป็นโค้ดใน config>>mail.php
'driver' => 'smtp',
'host' => 'smtp.gmail.com',
'port' => 587,
'from' => array('address' => null, 'name' => null),
'encryption' => 'tls',
'username' => '[email protected]',
'password' => 'xxxxxx',
'sendmail' => '/usr/sbin/sendmail -bs',
'pretend' => false
และนี่คือตัวอย่างโค้ด วิธีส่งอีเมลของฉัน
$from = '[email protected]';
$mail = Mail::send('mailer_template', ['any_data' => $data], function ($msg) use ($from, $from_name, $to_email, $subject, $attach) {
$msg->from($from,$from_name);
$msg->to($to_email);
$msg->subject($subject);
$msg->attach($attach);
});
เมื่อฉันส่งจดหมาย จดหมายก็ถูกส่งไป แต่ถูกส่งมาจาก - '[email protected]' ฉันต้องการให้ส่งทางอีเมลใน $from variabble และที่อยู่ผู้ส่งจะเปลี่ยนไปตามสถานที่ต่างๆ ฉันไม่แน่ใจว่าจะกำหนดค่านี้อย่างไร ความช่วยเหลือใด ๆ ที่จะได้รับการชื่นชม