Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 29th, 2012  |  syntax: None  |  size: 1.30 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Minimizing Zend Framework to Zend_Mail? [closed]
  2. <?php
  3. // optionally
  4. // set_include_path(get_include_path() . PATH_SEPARATOR . '/path/to/Zend');
  5.  
  6. require_once 'Zend/Mail.php';
  7. require_once 'Zend/Mail/Transport/Sendmail.php';
  8.  
  9. $transport = new Zend_Mail_Transport_Sendmail();
  10.  
  11. $mail = new Zend_Mail();
  12. $mail->addTo('user@domain')
  13.      ->setSubject('Mail Test')
  14.      ->setBodyText("Hello,nThis is a Zend Mail message...n")
  15.      ->setFrom('sender@domain');
  16.  
  17. try {
  18.     $mail->send($transport);
  19.     echo "Message sent!<br />n";
  20. } catch (Exception $ex) {
  21.     echo "Failed to send mail! " . $ex->getMessage() . "<br />n";
  22. }
  23.        
  24. <?php
  25.  
  26. require_once 'Zend/Mail.php';
  27. require_once 'Zend/Mail/Transport/Smtp.php';
  28.  
  29. $config    = array(//'ssl' => 'tls',
  30.                    'port' => '25', //465',
  31.                    'auth' => 'login',
  32.                    'username' => 'user',
  33.                    'password' => 'password');
  34.  
  35. $transport = new Zend_Mail_Transport_Smtp('smtp.example.com', $config);
  36.  
  37. $mail = new Zend_Mail();
  38. $mail->addTo('user@domain')
  39.      ->setSubject('Mail Test')
  40.      ->setBodyText("Hello,nThis is a Zend Mail message...n")
  41.      ->setFrom('sender@domain');
  42.  
  43. try {
  44.     $mail->send($transport);
  45.     echo "Message sent!<br />n";
  46. } catch (Exception $ex) {
  47.     echo "Failed to send mail! " . $ex->getMessage() . "<br />n";
  48. }