1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18:
19:
20: 21: 22: 23: 24:
25: class MailTransport extends AbstractTransport {
26:
27: 28: 29: 30: 31: 32:
33: public function send(CakeEmail $email) {
34: $eol = PHP_EOL;
35: if (isset($this->_config['eol'])) {
36: $eol = $this->_config['eol'];
37: }
38: $headers = $email->getHeaders(array('from', 'sender', 'replyTo', 'readReceipt', 'returnPath', 'to', 'cc', 'bcc'));
39: $to = $headers['To'];
40: unset($headers['To']);
41: $headers = $this->_headersToString($headers, $eol);
42: $message = implode($eol, $email->message());
43: if (ini_get('safe_mode') || !isset($this->_config['additionalParameters'])) {
44: if (!@mail($to, $email->subject(), $message, $headers)) {
45: throw new SocketException(__d('cake_dev', 'Could not send email.'));
46: }
47: } elseif (!@mail($to, $email->subject(), $message, $headers, $this->_config['additionalParameters'])) {
48: throw new SocketException(__d('cake_dev', 'Could not send email.'));
49: }
50: return array('headers' => $headers, 'message' => $message);
51: }
52:
53: }
54: