Mail.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. /**
  3. *
  4. * Cube Framework $Id$ ogzubZwehP/Dbar/vhFenwBJAAkAUl0ok54nV45kx1k=
  5. *
  6. * @link http://codecu.be/framework
  7. * @copyright Copyright (c) 2015 CodeCube SRL
  8. * @license http://codecu.be/framework/license Commercial License
  9. *
  10. * @version 1.4
  11. */
  12. /**
  13. * mailer transport class - using php mail function
  14. */
  15. namespace Cube\Mail\Transport;
  16. class Mail extends AbstractTransport
  17. {
  18. /**
  19. *
  20. * send mail method
  21. *
  22. * @return bool
  23. */
  24. public function send()
  25. {
  26. $result = false;
  27. $mail = $this->getMail();
  28. $mailHeader = $mail->createHeader();
  29. $mailBody = $mail->getBody();
  30. $from = $mail->getFrom();
  31. $params = sprintf("-oi -f %s", $from['address']);
  32. if (!ini_get('safe_mode')) {
  33. ini_set('sendmail_from', $from['address']);
  34. }
  35. foreach ($mail->getTo() as $to) {
  36. $result = @mail($to['address'], $mail->getSubject(), $mailBody, $mailHeader, $params);
  37. }
  38. ini_restore('sendmail_from');
  39. return $result;
  40. }
  41. }