send() public method

Send a message.
public send ( mixed $from, mixed $to, mixed $data, array $opts = [] ) : array
$from mixed The from address. Either a Horde_Mail_Rfc822_Address object or a string.
$to mixed The to (recipient) addresses. Either a Horde_Mail_Rfc822_List object, a string, or an array of addresses.
$data mixed The data to send. Either a stream or a string.
$opts array
return array If no receipients were successful, a Horde_Smtp_Exception will be thrown. If at least one recipient was successful, an array with the following format is returned: (@since 1.5.0) - KEYS: Recipient addresses ($to addresses). - VALUES: Boolean true (if message was accepted for this recpieint) or a Horde_Smtp_Exception (if messages was not accepted).
Exemplo n.º 1
0
 /**
  */
 public function send($recipients, array $headers, $body)
 {
     /* If we don't already have an SMTP object, create one. */
     $this->getSMTPObject();
     $headers = $this->_sanitizeHeaders($headers);
     list($from, $textHeaders) = $this->prepareHeaders($headers);
     $from = $this->_getFrom($from, $headers);
     $combine = Horde_Stream_Wrapper_Combine::getStream(array(rtrim($textHeaders, $this->sep), $this->sep . $this->sep, $body));
     try {
         $this->_smtp->send($from, $recipients, $combine);
     } catch (Horde_Smtp_Exception $e) {
         throw new Horde_Mail_Exception($e);
     }
 }