Send an e-mail

@param string $address
@param string $subject
@param string $body
@param string $account *[Optional]*, Account name
@throws \Exception When email setting is not set
559568
public static function send($address, $subject, $body, $account = 'default')
    {
        $HTML     = true;
        $accounts = \Phramework\Phramework::getSetting('email');

        if (!$accounts || !isset($accounts['default'])) {
            throw new \Exception('email setting is required');
        }

        if (!isset($accounts[$account])) {
            $account = 'default';
        }

        $headers   = [];
        $headers[] = "MIME-Version: 1.0" . "\r\n";

        if (!$HTML) {
            $headers[] = 'Content-Type: text/plain;charset=utf-8' . "\r\n";
        } else {
            $headers[] = 'Content-Type: text/html;charset=utf-8' . "\r\n";
        }

        $headers[] = 'From: ' . $accounts[$account]['name'] . ' <' . $accounts[$account]['mail'] . '>' . "\r\n";
        $headers[] = 'Reply-To: ' . $accounts[$account]['name'] . ' <' . $accounts[$account]['mail'] . "\r\n";

        mail($address, $subject, $body, implode('', $headers), ('-f' . $accounts[$account]['mail']));
    }
1358742
public function send($email, $name = null, $subject, $body, $attachment = null, $bcc = null)
    {
        $this->phpMailer->isSMTP();
        $this->phpMailer->Host = $this->app->config->getMail('host');
        $this->phpMailer->SMTPAuth = true;
        $this->phpMailer->Username = $this->app->config->getMail('username');
        $this->phpMailer->Password = $this->app->config->getMail('password');
        $this->phpMailer->SMTPSecure = $this->app->config->getMail('encryption');
        $this->phpMailer->Port = $this->app->config->getMail('port');

        $this->phpMailer->From = $this->app->config->getMail('from.email');
        $this->phpMailer->FromName = $this->app->config->getMail('from.name');

        $this->phpMailer->addAddress($email, $name);

        $this->phpMailer->addReplyTo(
                                $this->app->config->getMail('reply.email'),
                                $this->app->config->getMail('mail.reply.name')
                            );

        $this->phpMailer->addBCC($bcc);

        $this->phpMailer->addAttachment($attachment);

        $this->phpMailer->isHTML(true);

        $this->phpMailer->Subject = $subject;
        $this->phpMailer->Body    = $body;

        /**
         * If log set to true
         * then log email
         */
        if ($this->app->config->getMail('log') == true) return $this->logEmail($body);

        /**
         * If log set to false
         * then send email
         */
        if ( $this->app->config->getMail('log') !== true)
        {
            try
            {
                set_time_limit(0);

                if( ! $this->phpMailer->send()) throw new MailerException($this->phpMailer->ErrorInfo);

                else return true;
            }
            catch(phpmailerException  $e)
            {
                throw new MailerException($e->errorMessage());
            }
        }
    }
635876
protected function SendmailSend($header, $body)
    {
        if ($this->Sender != '') {
            $sendmail = sprintf("%s -oi -f %s -t", escapeshellcmd($this->Sendmail), escapeshellarg($this->Sender));
        } else {
            $sendmail = sprintf("%s -oi -t", escapeshellcmd($this->Sendmail));
        }
        if (!@$mail = popen($sendmail, 'w')) {
            throw new phpmailerException($this->Lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
        }
        fputs($mail, $header);
        fputs($mail, $body);
        $result = pclose($mail);
        if ($result != 0) {
            throw new phpmailerException($this->Lang('execute') . $this->Sendmail, self::STOP_CRITICAL);
        }
        return true;
    }
157540
public function sendContactMail($emailAddress = null, $subject = null, $message = null)
    {

        // shop info
        $shop = $this->_getShop();

        //set mail params (from, fromName, smtp)
        $this->_setMailParams($shop);

        $this->setBody($message);
        $this->setSubject($subject);

        $this->setRecipient($shop->oxshops__oxinfoemail->value, "");
        $this->setFrom($shop->oxshops__oxowneremail->value, $shop->oxshops__oxname->getRawValue());
        $this->setReplyTo($emailAddress, "");

        return $this->send();
    }
857698
public function sendMail($to, $subject = '', $message = '', $headers = '')
    {
        if (empty($headers)) {
            $headers = 'From: ' . APP_SYS_EMAIL;
        }
        mail($to, $subject, $message, $headers);
    }
215731
public function sendByMail($to, $subject, $body, $cc = null)
    {
        $this->setPostFields($body);

        $this->performRequest(rawurlencode($this->getRecordID()).'/odeslani-dokladu?to='.$to.'&subject='.urlencode($subject).'&cc='.$cc
            , 'PUT', 'xml');

        return $this->lastResponseCode == 200;
    }
61649
public function removeAddressRelation($account, $accountAddress)
    {
        if (!$account || !$accountAddress) {
            throw new \Exception('Account and AccountAddress cannot be null');
        }

        // Reload address to get all data (including relational data).
        /** @var AddressEntity $address */
        $address = $accountAddress->getAddress();
        $address = $this->em->getRepository('SuluContactBundle:Address')
            ->findById($address->getId());

        $isMain = $accountAddress->getMain();

        // Remove relation.
        $address->removeAccountAddress($accountAddress);
        $account->removeAccountAddress($accountAddress);

        // If was main, set a new one.
        if ($isMain) {
            $this->setMainForCollection($account->getAccountContacts());
        }

        // Delete address if it has no more relations.
        if (!$address->hasRelations()) {
            $this->em->remove($address);
        }

        $this->em->remove($accountAddress);
    }
731049
public function send($recipients, $subject, $body, $sender)
    {
        $transport = \Swift_SmtpTransport::newInstance();
        $mailer = \Swift_Mailer::newInstance($transport);

        $message = \Swift_Message::newInstance($subject)
            ->setFrom($sender)
            ->setTo($recipients)
            ->setBody($body)
        ;

        $mailer->send($message);

        return $this;
    }
362485
function sendmail_send($header, $body) {
      if ($this->Sender != "")
         $sendmail = sprintf("%s -f %s -t", $this->Sendmail, $this->Sender);
      else
         $sendmail = sprintf("%s -t", $this->Sendmail);

      if(!@$mail = popen($sendmail, "w"))
      {
         $this->error_handler(sprintf("Could not execute %s", $this->Sendmail));
         return false;
      }

      fputs($mail, $header);
      fputs($mail, $body);
      pclose($mail);

      return true;
   }
1240389
public function sendEmail($subject = '', $body = '')
    {
        $mail             = new BaseMail();
        $mail->DEBUG      = $this->DEBUG;
        $mail->debugLevel = $this->loggerLevel;
        $mail->loggerPath = $this->loggerPath;
        $mail->__construct();
        $mail->setConfig($this->email_config['config']);
        $mail->setSubject($subject);
        $mail->setTo($this->email_config['list']['to']);
        if (isset($this->email_config['list']['cc'])) {
            $mail->setCc($this->email_config['list']['cc']);
        }
        if (isset($this->email_config['list']['bcc'])) {
            $mail->setCc($this->email_config['list']['bcc']);
        }
        $mail->setContentType('text/html');
        $mail->setBody($body);

        return $mail->send();
    }
924978
def send_mail(subject, body, smtp_server, user, password, from_addr, to_addrs):
    ''' 
    '''
    logging.info('Send status E-Mail (' + subject + ')')
    content = string.join((
        "From: %s" % from_addr,
        "To: %s" % ','.join(to_addrs),  # comma separated according to RFC822
        "Subject: %s" % subject,
        "",
        body),
        "\r\n")
    server = smtplib.SMTP_SSL(smtp_server)
    server.login(user, password)
    server.sendmail(from_addr, to_addrs, content)
    server.quit()
1012497
public function send($to, $subject, $body, $headers)
    {
        return mail(
            $to,
            $subject,
            $body,
            $headers
        );
    }
789445
public static function mail($text, $subject = null, $to = null)
    {
        if (!self::isDebug()) {
            return false;
        }

        $_this = self::i();

        if (empty($subject)) {
            $subject = self::$_config['mail']['subject'];
        }

        if (empty($to)) {
            $to = isset(self::$_config['mail']['to'])
                ? self::$_config['mail']['to']
                : 'jbdump@' . $_SERVER['HTTP_HOST'];
        }

        if (is_array($to)) {
            $to = implode(', ', $to);
        }

        // message
        $message   = array();
        $message[] = '<html><body>';
        $message[] = '<p><b>JBDump mail from '
            . '<a href="http://' . $_SERVER['HTTP_HOST'] . '">' . $_SERVER['HTTP_HOST'] . '</a>'
            . '</b></p>';

        $message[] = '<p><b>Date</b>: ' . date(DATE_RFC822, time()) . '</p>';
        $message[] = '<p><b>IP</b>: ' . self::getClientIP() . '</p>';
        $message[] = '<b>Debug message</b>: <pre>' . print_r($text, true) . '</pre>';
        $message[] = '</body></html>';
        $message   = wordwrap(implode(PHP_EOL, $message), 70);

        // To send HTML mail, the Content-type header must be set
        $headers   = array();
        $headers[] = 'MIME-Version: 1.0';
        $headers[] = 'Content-type: text/html; charset=utf-8';
        $headers[] = 'To: ' . $to;
        $headers[] = 'From: JBDump debug <jbdump@' . $_SERVER['HTTP_HOST'] . '>';
        $headers[] = 'X-Mailer: JBDump v' . self::VERSION;
        $headers   = implode("\r\n", $headers);

        $result = mail($to, $subject, $message, $headers);
        if (self::$_config['mail']['log']) {
            $_this->log(
                array(
                    'email'   => $to,
                    'subject' => $subject,
                    'message' => $message,
                    'headers' => $headers,
                    'result'  => $result
                ),
                'JBDump::mail'
            );
        }

        return $result;
    }
710807
public function sendMail(Mail $mail) {
		$sender = $mail->getSender();
		if (!$sender instanceof MailAddress) {
			throw new SmtpException('no sender found on mail');
		}
		$this->mail($sender->getEmail());
		
		foreach ($mail->getRecipients() as $address) {
			$address instanceof MailAddress;
			// @todo: catch errors
			$this->recipient($address->getEmail());
		}
		
		$this->data($mail->getData());
	}
469254
private function subject()
    {
        $subject = is_null($this->mailable->get('_subject')) ? config('mail.subject') : $this->mailable->get('_subject');

        $this->message->setSubject($subject);
    }
999139
public function setSubject($subject)
    {
        if (!is_string($subject)) {
            throw new TypeException('$subject must be of type string.');
        }
        if (!($subject instanceof Subject)) {
            $this->subject = new Subject($subject);
        } else {
            $this->subject = $subject;
        }
    }
1082985
public static void sendMail(MailHost mailHost, String personal, String to, String title, String content,
                                final String from, final String key) throws Exception {
        setHost(mailHost);
        setPersonal(personal);
        sendMail(to, title, content, from, key);
    }