laravel 5.2 mailgun发送succcefuly但未在收件箱中找到

时间:2016-12-10 08:16:50

标签: php laravel-5.2 mailgun

我尝试通过mailgun在localhost上的应用程序发送电子邮件。 当我提交。显示退回的电子邮件但我在收件箱中找不到蚂蚁消息 - 这是我的功能

public function send_mail(Request $request)
  {

    $rules = array(
        'name'       => 'required|max:50',
        'email'      => 'required',
        'mobile' => 'required|max:15',
        'message' => 'required|max:1000'

    );

    $v= \Validator::make($request->all(),  $rules);
    if ($v->fails()) {
           return redirect()->back()->withErrors($v->errors())->withInput($request->input());
         }else{
           $data = array(
          'name' => $request->name,
          'email' => $request->email,
          'mobile' => $request->mobile,
          'message' => $request->message,

          );
       Mail::send('website.contactus.mymessage', $data, function($message) use ($data){
         $message->from($data['email']);
         $message->to('azharnabil013@yahoo.com');
         $message->subject($data['message']);
         });


         return redirect('contact-us')->with('message', 'لقد تم ارسال الرساله بنجاح!');

         } 

-I添加包    "guzzlehttp/guzzle": "~4.0"

-make mailgun account
- 这是我的环境

MAIL_DRIVER=mailgun
MAIL_HOST=smtp.mailgun.org
MAIL_PORT=587
MAIL_USERNAME=***from mailgun account
MAIL_PASSWORD=***from mailgun account

- 并在config

中编辑mail.php和sevices

0 个答案:

没有答案