Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
SmtpAuthenticationFailedException
  • Hello, Im trying to write a Contact page, but my code has a problem, but I dk where.
    This error is Email\SmtpAuthenticationFailedException [ Error ]: Failed authentication.
    PKGPATH/email/classes/email/driver/smtp.php @ line 219

    Here's my code:
    <?php

    class Controller_Contact extends Controller_Template {

        public function action_index() {

            $form = Fieldset::forge();

            $textarea = array('type' => 'textarea', 'cols' => 40, 'rows' => 5);
            $submit = array('type' => 'submit', 'value' => 'Send');

            $form->add('to', 'To')
                    ->add_rule('valid_email')
                    ->add_rule('required');
            $form->add('from', 'From')
                    ->add_rule('valid_email')
                    ->add_rule('required');
            $form->add('subject', 'Subject');
            $form->add('body', 'Body', $textarea)
                    ->add_rule('required');
            $form->add('submit', '', $submit);

            $form->repopulate();

            $view = View::forge('contact/test1');
            $view->set_safe('mail_form', $form);

            $val = $form->validation();

            if ($val->run()) {

                $to = Input::post('to');
                $from = Input::post('from');
                $subject = Input::post('subject');
                $body = Input::post('body');

                $email = Email::forge();

                $email->to($to);
                $email->from($from);
                $email->subject($subject);
                $email->body($body);

                $email->send();

                return Response::forge(View::forge('contact/test2'));
            } else {

                $errors = $val->error();
                $view->set('errors', $errors);
                return $view;
            }
        }

    }


    Email config file:
    'driver' => 'smtp',

    'smtp' => array(
    'host'      => 'ssl://smtp.gmail.com',
    'port'      => 465,
    'username'  => 'xxx@gmail.com',
    'password'  => 'xxx',
    'timeout'   => 5,
    'starttls'  => false,

    Someone could give me some advices
  • Did you set the newline to "\r\n" ?
  • Yes, I did.
  • Sorry, I fixed it, the problem is my gmail account, I already turn on POP3 and IMAP but my account didnt active them, but now is ok. 
    Sorry to bother you.
  • No problem, good you've fixed it.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion