php - sending email from laravel using another "from" header -
blahblahhi know how set part of email. in config email can set there want use noreply@whatever.com
e.g. code below doesn't work tho
mail::send('emails.auth.activate', array('link' => url::route('account-activate', $code), 'username' => $username), function($message) use ($user) { $message->from('noreply@whatever.com', 'activate account'); $message->to($user->email, $user->username)->subject('activate account'); });
i want able use noreplay@whatever.com
instead of using configuration setting in mail.php
when use $message->from('noreply@whatever.com', 'activate account');
still shows gmail account instead of noreply@whatever.com
<?php return array( /* |-------------------------------------------------------------------------- | mail driver |-------------------------------------------------------------------------- | | laravel supports both smtp , php's "mail" function drivers | sending of e-mail. may specify 1 you're using throughout | application here. default, laravel setup smtp mail. | | supported: "smtp", "mail", "sendmail", "mailgun", "mandrill", "log" | */ 'driver' => 'smtp', /* |-------------------------------------------------------------------------- | smtp host address |-------------------------------------------------------------------------- | | here may provide host address of smtp server used | applications. default option provided compatible | mailgun mail service provide reliable deliveries. | */ 'host' => 'smtp.gmail.com', /* |-------------------------------------------------------------------------- | smtp host port |-------------------------------------------------------------------------- | | smtp port used application deliver e-mails | users of application. host have set value | stay compatible mailgun e-mail application default. | */ 'port' => 587, /* |-------------------------------------------------------------------------- | global "from" address |-------------------------------------------------------------------------- | | may wish e-mails sent application sent | same address. here, may specify name , address | used globally e-mails sent application. | */ 'from' => array('address' => 'admin@blahblah.com', 'name' => 'superstore'), /* |-------------------------------------------------------------------------- | e-mail encryption protocol |-------------------------------------------------------------------------- | | here may specify encryption protocol should used when | application send e-mail messages. sensible default using | transport layer security protocol should provide great security. | */ 'encryption' => 'tls', /* |-------------------------------------------------------------------------- | smtp server username |-------------------------------------------------------------------------- | | if smtp server requires username authentication, should | set here. used authenticate server on | connection. may set "password" value below one. | */ 'username' => 'blahblah@gmail.com', /* |-------------------------------------------------------------------------- | smtp server password |-------------------------------------------------------------------------- | | here may set password required smtp server send out | messages application. given server on | connection application able send messages. | */ 'password' => '**********', /* |-------------------------------------------------------------------------- | sendmail system path |-------------------------------------------------------------------------- | | when using "sendmail" driver send e-mails, need know | path sendmail lives on server. default path has | been provided here, work on of systems. | */ 'sendmail' => '/usr/sbin/sendmail -bs', /* |-------------------------------------------------------------------------- | mail "pretend" |-------------------------------------------------------------------------- | | when option enabled, e-mail not sent on | web , instead written application's logs files | may inspect message. great local development. | */ 'pretend' => false, );
you cannot trigger email cross-domain
i.e.,
if have smtp configured gmail , cannot send mail other domains.
this related email spoofing not allowed.
you can send emails domain have configured in mail.php
.
full transcript of chat might future readers
Comments
Post a Comment