大家好我在发送电子邮件时在laravel中遇到错误。 我有一个选择标记 的表单,当我选择用户并单击提交时,我需要在选择它后发送邮件给他。Laravel 4.2发送电子邮件错误
这里是我的控制器方法:
public function store()
{
$customerId = Input::get('customerid');
$invoice = New Invoice ;
$invoice->customerid = Input::get('customerid');
$invoice->save();
if($invoice->save()){
$email = Customer::whereRaw(' id = :customer',array('customer'=> $customerId))->first(array('email'));
Mail::send('invoices.mail', array($pinvoices,$unpinvoices), function($message){
$message->to($email , 'Name')->subject('your invoices ');
});
}
}
当我点击提交我得到一个错误:
未定义的变量:电子邮件
,当我试着添加我的电子邮件作为静态值,如:
$email = "[email protected]" ;
Mail::send('invoices.mail', array($pinvoices,$unpinvoices), function($message){
$message->to($email , 'Name')->subject('your invoices ');
});
它也得到相同的错误!
,当我把这样的值:
Mail::send('invoices.mail', array($pinvoices,$unpinvoices), function($message){
$message->to("[email protected]" , 'Name')->subject('your invoices ');
});
它完美的作品!
它的工作非常感谢:) – Muhammed