Using authenticated SMTP

Webfaction, and probably other hosting providers, using a different host and authentication for SMTP. There's a post about it on the Webfaction forums.

Because of this you'll get an error when you create a new user (the user is created but the activation email isn't sent).

I fixed this by modifying /application/controllers/User_controller.php thusly:

In sendActivationEmail before '$mail = new Zend_Mail();' add

$smtpAuth = array('auth' => 'login',
					'username' => '[your mailbox name]',
					'password' => '[your mailbox password]');
        $transport = new Zend_Mail_Transport_Smtp('smtp.webfaction.com', $smtpAuth);

Then change $mail->send(); to $mail->send($transport);

The next question is how to send the forgotten password emails. forgotPasswordAction doesn't seem to use Zend_Mail for some reason and doesn't complain about errors, but neither does it send the email.

Is there any reason why this can't be changed to use Zend_Mail (and thereby authentication)?

Is there any reason why this can't be changed to use Zend_Mail (and thereby authentication)?

That's a fantastic question, Tim. I'll ask our development team. Seems like a good thing to do, especially since we want use Zend components as much as possible.

The only issue I could see is, when using Zend_Mail_Transport_Smtp, is providing the SMPT address to the function dynamically, instead of writing that in yourself. It may have to be an additional setting that can be configured in the admin panel.

Thanks Jeremy, yep having the SMTP settings as config variables would be great.