3

I'm trying to send emails (Gmail) using the built in SwiftMailer bundle with Laravel 4. I've successfully been able to send and receive emails on my local server, when live, I keep receiving this error message:

Failed to authenticate on SMTP server with username "info@myemail.com" using 2 possible authenticators

controller (show_sent method)

public function show_sent() {

    $name = Input::get('name', 'someone');
    $email = Input::get('email');
    
    // I'm creating an array with user's info but most likely you can use $user->email or pass $user object to closure later
    $user = array(
        'email'=>'info@myemail.com',
        'name'=> $name
    );
     
    // the data that will be passed into the mail view blade template
    $data = array(
        'detail'=>'Visitor\'s website enquiry',
        'name'  => $user['name'],
        'email'=> $email
    );
     
    // use Mail::send function to send email passing the data and using the $user variable in the Closure
    Mail::send('emails.registration', $data, function($message) use ($user)
    {
      $message->from('info@myemail.com', 'someone');
      $message->to($user['email'], $user['name'])->subject('New Site Registration');
    });

    $view = View::make('sent');
    $view->title = 'Sent';
    $view->keywords = 'to complete'; 
    $view->description = 'to complete';
$view->body_id = 'sent-page';
    return $view;       
}

mail.php settings:

'driver' => 'smtp',
'host' => 'smtp.gmail.com',
'port' => 465,
'encryption' => 'ssl',

I've tried using a few other gmail accounts, all had the same error message. Any help would be fantastic, thanks in advance!

Pathum Bandara
  • 343
  • 2
  • 3
  • 12
designfreak
  • 51
  • 1
  • 6
  • Try the the solution from http://stackoverflow.com/questions/12663783/php-fatal-error-swift-transportexception-with-message-failed-to-authenticate – m1kfb Aug 16 '13 at 10:32

0 Answers0