Zend Mail - SMPT


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. // file.ini
  2. [smtp]
  3. serwer=yanek.code-laboratory.com
  4. username=yanek@code-laboratory.com
  5. password=pass
  6.  
  7. // controller
  8. $smtp = new Zend_Config_Ini ('/application/config/file.ini', 'smtp');
  9. $config = array('auth'=>'login', 'username'=>$smtp->username, 'password'=>$smtp->password);
  10. $transport = new Zend_Mail_Transport_Smtp($smtp->serwer, $config);
  11. Zend_Mail::setDefaultReplyTo('[email protected]');
  12.  
  13. foreach ($mails as $mail){
  14. try {
  15. $zm = new Zend_Mail('utf-8');
  16. $zm->setBodyHtml( 'hello world' );
  17. $zm->setFrom( $smtp->username, 'yanek' );
  18. $zm->addTo( $mail );
  19. $zm->setSubject( 'Subject' );
  20. $zm->send($transport);
  21. } catch (Exception $e){}
  22. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.