B
B
Blud732014-03-30 06:20:35
Laravel
Blud73, 2014-03-30 06:20:35

Swift_RfcComplianceException - how to fix the error?

I get an error when sending a mail - Swift_RfcComplianceException
Address in mailbox given [] does not comply with RFC 2822, 3.6.2.
The code:

$input = Input::all();

    $validator = Validator::make(
        $input,
      array(
        'pass' => 'required|min:5|confirmed',
        'email' => 'required|email'
      ));

      if ($validator->fails()) {

   		$messages = $validator->messages();
   		return Redirect::to('registration')->withErrors($messages)->withInput();

    }else{
    try{

           $user = Sentry::register(array(
          	'email'     => $input['email'],
          	'password'  => $input['pass']
     			 ));


     		$data = array('code' => $user->getActivationCode());
          $email = $input['email'];
          
          Mail::send('emails.activation', $data, function($message)
      {
        global $email;
          $message->to($email)->subject('Спасибо за регистрацию!');
      });

      }catch(Cartalyst\Sentry\Users\UserExistsException $e){
          	return Redirect::to('registration')->with('mes','Данный пользователь уже существует!')->withInput();
     		}
    }

    return View::make('registration_success');
  }

I am using Sentry2. I don’t understand what the error is, in the settings the data from whom I transfer. I ship to an existing mailbox.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
ellrion, 2014-08-11
@ellrion

global $email;
Are you serious?!
why not ?

Mail::send('emails.activation', $data, function($message) use ($input) {
    $message->to($input['email'])->subject('Спасибо за регистрацию!');
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question