Things to Remember

Sunday, 7 November 2010

zend settings production v testing etc

bung this in your controllers init method:

//to get the email options from application.ini

$bootstrap = $this->getInvokeArg('bootstrap');

$configArray = $bootstrap->getOptions();

$this->config = new Zend_Config($configArray);



settings in application.ini should look like this:


email.outgoingserver = "auth.smtp.1and1.co.uk"

email.username = "noreply@playerreg.co.uk"

email.password = "pass"


call it in your action like this:

//setup email (this should really go elsewhere)

$emailusername = $this->config->email->username;

$emailpassword = $this->config->email->password;

$server = $this->config->email->outgoingserver;

$config = array('auth' => 'login',

'username' => $emailusername,

'password' => $emailpassword);

$transport = new Zend_Mail_Transport_Smtp($server,$config);

Zend_Mail::setDefaultTransport($transport);