Guest User

Untitled

a guest
Aug 12th, 2018
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. Multiple Zend_Mail configurations in application.ini
  2. mail_config.mail_test.transport.type = smtp
  3. mail_config.mail_test.transport.host = "smtp.example.com"
  4. mail_config.mail_test.transport.auth = login
  5. mail_config.mail_test.transport.username = myUsername
  6. mail_config.mail_test.transport.password = myPassword
  7.  
  8. mail_config.mail_test.defaultFrom.email = john@example.com
  9. mail_config.mail_test.defaultFrom.name = "John Doe"
  10. mail_config.mail_test.defaultReplyTo.email = Jane@example.com
  11. mail_config.mail_test.defaultReplyTo.name = "Jane Doe"
  12.  
  13. <?php
  14.  
  15. class Application_Service_MailSettings extends Zend_Application_Resource_Mail { }
  16.  
  17. // get the bootstrap, so we can get mail_config options
  18. $bootstrap = $this->getInvokeArg('bootstrap');
  19. $options = $bootstrap->getOption('mail_config');
  20.  
  21. // initialize the resource loader with the options from mail_config.mail_test
  22. $mailSettings = new Application_Service_MailSettings($options['mail_test']);
  23. $mailSettings->init(); // call init() so the settings are applied
  24.  
  25. // now the default transport, from, and reply to are set using mail_config.mail_test options.
  26.  
  27. // to use a different set of options, just do
  28. // $mailSettings = new Application_Service_MailSettings($options['other_config');
Add Comment
Please, Sign In to add comment