[英]Sending Email From A Custom Email Address
Is there a way to send email using a customized Email address. 有没有一种使用自定义电子邮件地址发送电子邮件的方法。 For example, i have a domain (www.laracast.com) and a customised Email (noreply@laracast.com). 例如,我有一个域(www.laracast.com)和一个自定义的电子邮件(noreply@laracast.com)。
How do i send Email from noreply@laracast.com to my users 我如何从noreply@laracast.com向我的用户发送电子邮件
I have this in env 我在环境中有这个
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=xxxxxxxxxxxxx
MAIL_PASSWORD=xxxxxxxxxxxx
MAIL_ENCRYPTION=null
and my config/mail.php 和我的config / mail.php
return [
'driver' => env('MAIL_DRIVER', 'smtp'),
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
'port' => env('MAIL_PORT', 587),
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'noreply@pconnect.com'),
'name' => env('MAIL_FROM_NAME', 'PConnect'),
],
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'sendmail' => '/usr/sbin/sendmail -bs',
'markdown' => [
'theme' => 'default',
'paths' => [
resource_path('views/vendor/mail'),
],
],
];
You are going to send an email, so the protocol you are going to use is smtp. 您将要发送电子邮件,因此要使用的协议是smtp。 Then 然后
'from' => [ 'address' => env('MAIL_FROM_ADDRESS', 'The Email Address THAT I WANT TO USE'), 'name' => env('MAIL_FROM_NAME', 'THE NAME WHICH IS GOING TO APPEAR IN THE USER'S INBOX'), ],
OR instead of 3: 或而不是3:
in your env file, set the MAIL_FROM_NAME and MAIL_FROM_ADDRESS. 在您的环境文件中,设置MAIL_FROM_NAME和MAIL_FROM_ADDRESS。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.