Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Multiple Zend_Mail configurations in application.ini
- mail_config.mail_test.transport.type = smtp
- mail_config.mail_test.transport.host = "smtp.example.com"
- mail_config.mail_test.transport.auth = login
- mail_config.mail_test.transport.username = myUsername
- mail_config.mail_test.transport.password = myPassword
- mail_config.mail_test.defaultFrom.email = john@example.com
- mail_config.mail_test.defaultFrom.name = "John Doe"
- mail_config.mail_test.defaultReplyTo.email = Jane@example.com
- mail_config.mail_test.defaultReplyTo.name = "Jane Doe"
- <?php
- class Application_Service_MailSettings extends Zend_Application_Resource_Mail { }
- // get the bootstrap, so we can get mail_config options
- $bootstrap = $this->getInvokeArg('bootstrap');
- $options = $bootstrap->getOption('mail_config');
- // initialize the resource loader with the options from mail_config.mail_test
- $mailSettings = new Application_Service_MailSettings($options['mail_test']);
- $mailSettings->init(); // call init() so the settings are applied
- // now the default transport, from, and reply to are set using mail_config.mail_test options.
- // to use a different set of options, just do
- // $mailSettings = new Application_Service_MailSettings($options['other_config');
Add Comment
Please, Sign In to add comment