{"action":"created","issue":{"url":"https://api.github.com/repos/laravel/framework/issues/21216","repository_url":"https://api.github.com/repos/laravel/framework","labels_url":"https://api.github.com/repos/laravel/framework/issues/21216/labels{/name}","comments_url":"https://api.github.com/repos/laravel/framework/issues/21216/comments","events_url":"https://api.github.com/repos/laravel/framework/issues/21216/events","html_url":"https://github.com/laravel/framework/issues/21216","id":258280258,"number":21216,"title":"Problems using Mailer from /sender address","user":{"login":"nivanmorgan","id":8334562,"avatar_url":"https://avatars0.githubusercontent.com/u/8334562?v=4","gravatar_id":"","url":"https://api.github.com/users/nivanmorgan","html_url":"https://github.com/nivanmorgan","followers_url":"https://api.github.com/users/nivanmorgan/followers","following_url":"https://api.github.com/users/nivanmorgan/following{/other_user}","gists_url":"https://api.github.com/users/nivanmorgan/gists{/gist_id}","starred_url":"https://api.github.com/users/nivanmorgan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nivanmorgan/subscriptions","organizations_url":"https://api.github.com/users/nivanmorgan/orgs","repos_url":"https://api.github.com/users/nivanmorgan/repos","events_url":"https://api.github.com/users/nivanmorgan/events{/privacy}","received_events_url":"https://api.github.com/users/nivanmorgan/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-09-17T05:09:24Z","updated_at":"2017-09-18T11:52:50Z","closed_at":"2017-09-18T11:52:50Z","author_association":"NONE","body":"- Laravel Version: 5.4\r\n- PHP Version: 7.0\r\n- Database Driver & Version: MySQL 5.7\r\n\r\n### Description:\r\n\r\nI have Mailer functionality built into my business app. I'm using smtp to send out client emails. The emails should be send from the client email address but instead are sent from the system. In other words the sender appears as the system email no matter what I try. I do not have a default from address in my mail config file nor in my .env file.  I'm sure the email is sent to the Mailer since these are the errors I get:\r\n\r\nIf I use $sender as a dependency as shown in the code, it sends but from the system email. When I send an email it sends from support@system.com not the user email \r\n\r\n\r\nIf I use $from as a dependency to inject to the email I get an even worse error.\r\n\r\n![3](https://user-images.githubusercontent.com/8334562/30518129-cf542c2a-9b42-11e7-98e3-5e837b5abfc1.PNG)\r\n\r\nBelow is another error I get when I tried to debug the Mailer class in the framework. In the image the sender email is correctly passed to the Mailer send method. \r\n\r\n![sender](https://user-images.githubusercontent.com/8334562/30518194-702c0716-9b44-11e7-8cb8-3cd3e9c0e511.PNG)\r\n\r\nAccording to the documentation this is a lot easier than what I'm experiencing.\r\n\r\n\r\n### Steps To Reproduce:\r\n\r\nHere is my Mailable class\r\n\r\nclass UserEmail extends Mailable\r\n{\r\n    use Queueable, SerializesModels;\r\n\r\n    public $sender,$name, $subject, $content, $attach;\r\n\r\n    /**\r\n     * Create a new message instance.\r\n     *\r\n     * @return void\r\n     */\r\n    public function __construct($sender, $name, $subject, $content, $attach)\r\n    {\r\n        //\r\n        $this->sender = $sender;\r\n        $this->name = $name;\r\n        $this->subject = $subject;\r\n        $this->content = $content;\r\n        $this->attach = $attach;\r\n    }\r\n\r\n    /**\r\n     * Build the message.\r\n     *\r\n     * @return $this\r\n     */\r\n    public function build()\r\n    {\r\n \r\n                    return  $this->from($this->sender, $this->name)\r\n                              ->view('mailbox.sendmail')\r\n                              ->subject($this->subject)\r\n                              ->with(['t_body' => $this->content, 'title' => $this->subject])\r\n                              ->withSwiftMessage(function ($message) {\r\n                                  $message->getHeaders();\r\n                              });\r\n\r\n                          for ($i = 0; $i < count($this->attach); $i++) {\r\n                              $this->attach($this->attach[$i]);\r\n                          }\r\n          }\r\n\r\n    }\r\n\r\nAnd in my Emailcontroller I'm sending the variables\r\n\r\n      $sender = (isset($configuration['serveruser']) && $configuration['serveruser'] != '') ? \r\n      $configuration['serveruser'] : Auth::user()->email ;\r\n                    $name = Auth::user()->name;\r\n                    $subject = $request->subject;\r\n                    $content = $request->input( 'content' );\r\n                    $attach = $files;\r\n\r\n       Mail::to($request->to)->send((new UserEmail($sender, $name,$subject, $content, $attach))->onQueue('emails'));\r\n\r\nmail.php\r\n     \r\n      //    'from' => [\r\n     //        'address' => '',\r\n    //        'name' => '',\r\n    //    ],\r\n\r\nOur system is live and I can't fix this and users will not want to send emails. Is it a bug? according to the documentation, if I set $this->from(address, name) , it sends from that email address."},"comment":{"url":"https://api.github.com/repos/laravel/framework/issues/comments/330197398","html_url":"https://github.com/laravel/framework/issues/21216#issuecomment-330197398","issue_url":"https://api.github.com/repos/laravel/framework/issues/21216","id":330197398,"user":{"login":"themsaid","id":4332182,"avatar_url":"https://avatars3.githubusercontent.com/u/4332182?v=4","gravatar_id":"","url":"https://api.github.com/users/themsaid","html_url":"https://github.com/themsaid","followers_url":"https://api.github.com/users/themsaid/followers","following_url":"https://api.github.com/users/themsaid/following{/other_user}","gists_url":"https://api.github.com/users/themsaid/gists{/gist_id}","starred_url":"https://api.github.com/users/themsaid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/themsaid/subscriptions","organizations_url":"https://api.github.com/users/themsaid/orgs","repos_url":"https://api.github.com/users/themsaid/repos","events_url":"https://api.github.com/users/themsaid/events{/privacy}","received_events_url":"https://api.github.com/users/themsaid/received_events","type":"User","site_admin":false},"created_at":"2017-09-18T11:52:50Z","updated_at":"2017-09-18T11:52:50Z","author_association":"MEMBER","body":"Please ask on the forums, this repo is for bug reporting only. You can use https://laracasts.com/discuss or https://laravel.io/forum which are forums with a very large community of developers helping each other."}}
{"actor":{"display_login":"themsaid"}}