Laravel 4 Mail not passing data

后端 未结 2 1838
北恋
北恋 2021-01-22 13:45

Emails works fine with dummy data:

    Mail::send(\'emails.contact\', $messageData, function ($message) use ($messageData) {
        $message->from(\'joetanno         


        
相关标签:
2条回答
  • 2021-01-22 14:20

    You cannot use $message as your variable - see L4 docs here.

    So change it to something like "msg" - i.e.:

       $messageData = array(
            'name' => 'test name',
            'email' => 'test email',
            'msg' => 'test message'
        );
    
    0 讨论(0)
  • 2021-01-22 14:38
    $data = array( 'email' => 'sample@sample.com', 'first_name' => 'Lar', 'from' => 'sample@sample.comt', 'from_name' => 'Vel' );
    
    Mail::send( 'email.welcome', $data, function( $message ) use ($data)
    {
        $message->to( $data['email'] )->from( $data['from'], $data['first_name'] )->subject( 'Welcome!' );
    });
    
    0 讨论(0)
提交回复
热议问题