将变量传递到“发件人”时,Mailgun不传递电子邮件

时间:2019-02-16 20:25:08

标签: laravel mailgun

使用mailgun发送电子邮件许多小时后,我被mailgun的以下错误消息困住了:

Server response: 550 5.7.1 [104.130.122.30 14] Messages missing a valid address in From: 5.7.1 header, or having no From: header, are not accepted.

我在做什么错了?

*更新: 我从函数postContact中删除了$ message->。电子邮件正在发送,但电子邮件模板仅具有硬编码值。变量没有通过!

**更新: 我使用了php artisan cache:clear,现在电子邮件正在发送变量。不知道发生了什么。很想得到一个解释。

任何帮助将不胜感激!

PagesController.php:

public function postContact(Request $request){

  $this->validate($request,[
    'nameF' => 'min:3',
    'nameL' => 'min:3',
    'addy' => 'min:10',
  ]);

  $data = array(
    'nameF' => $request->NameF,
    'nameL' => $request->NameL,
    'addy' => $request->addy,
    'email' => $request->email,
    'pnumber' => $request->pnumber,
    'bodyMessage' => $request->Message
  );

  Mail::send('ContactMail', $data, function($message) use ($data){
    $message->to('visionquest.jesse@gmail.com');
    $message->from($data['email']);
    $message->subject($data['addy']);
  });

  Session::flash('success', 'Your email was sent!');

  return view('contact');

}

0 个答案:

没有答案