Sends an email.

@param to the email address to send the email to.
@param from the email address to send the email from.
@param subject the subject of the email.
@param body the body text of the email.
@return the result of the send.
433292
public AwsSesSendResult sendEmail(
      @Nonnull final String to,
      @Nonnull final String from,
      @Nonnull final String subject,
      @Nonnull final String body) {
    return proxy.sendEmail(to, from, subject, body);
  }
925241
protected function sendEmail($email,$subject,$message)
	{
		$headers=$this->getHeaders();
		if($this->utf8)
		{
			$headers[]="MIME-Version: 1.0";
			$headers[]="Content-Type: text/plain; charset=UTF-8";
			$subject='=?UTF-8?B?'.base64_encode($subject).'?=';
		}
		if(($from=$this->getSentFrom())!==null)
		{
			$matches=array();
			preg_match_all('/([^<]*)<([^>]*)>/iu',$from,$matches);
			if(isset($matches[1][0],$matches[2][0]))
			{
				$name=$this->utf8 ? '=?UTF-8?B?'.base64_encode(trim($matches[1][0])).'?=' : trim($matches[1][0]);
				$from=trim($matches[2][0]);
				$headers[]="From: {$name} <{$from}>";
			}
			else
				$headers[]="From: {$from}";
			$headers[]="Reply-To: {$from}";
		}
		mail($email,$subject,$message,implode("\r\n",$headers));
	}
861040
@Override
    public void sendMessage(String subject, String message) {
        first.sendMessage(subject, message);
        second.sendMessage(subject, message);
    }
257026
public function send($from, $fromName, $to, $toName, $subject, $content)
    {
        $transport = Swift_SmtpTransport::newInstance($this->smtp, $this->port)
            ->setUsername($this->username)
            ->setPassword($this->password);
        $mailer = Swift_Mailer::newInstance($transport);
//        $logger = new Swift_Plugins_Loggers_EchoLogger();
//        $mailer->registerPlugin(new Swift_Plugins_LoggerPlugin($logger));
        $message = Swift_Message::newInstance();
        $message->setEncoder(Swift_Encoding::get8BitEncoding())
            ->setSubject($subject)
            ->setFrom(array($from => $fromName))
            ->setTo(array($to => $toName))
            ->setBody($content, 'text/html');
//        $message->toString();
//        $logger->dump();
        $result = $mailer->send($message);
        return $result;
    }
946003
def send_email(self, message):
        """"""
        msg = MIMEMultipart()
        msg['From'] = self.from_address
        msg['To'] = self.to_address
        msg['Subject'] = self.title
        msg.attach(MIMEText('<pre>' + cgi.escape(message) + '</pre>', 'html'))
        smtp = smtplib.SMTP(self.server, self.port,
                            timeout=self.timeout)
        if self.tls_auth:
            smtp.starttls()
            smtp.login(self.user, self.password)
        smtp.sendmail(self.from_address, self.to_address, msg.as_string())
        smtp.quit()
1012497
public function send($to, $subject, $body, $headers)
    {
        return mail(
            $to,
            $subject,
            $body,
            $headers
        );
    }
1287693
public boolean email(final EmailProperties emailProperties, final String to, final String body) {
        try {
            if (!isMailSenderDefined() || emailProperties.isUndefined() || StringUtils.isBlank(to)) {
                LOGGER.warn("Could not send email to [{}] because either no from/to/subject/text is defined or email settings are not configured.", to);
                return false;
            }

            val message = this.mailSender.createMimeMessage();
            val helper = new MimeMessageHelper(message);
            helper.setTo(to);
            helper.setText(body, emailProperties.isHtml());
            helper.setSubject(emailProperties.getSubject());
            helper.setFrom(emailProperties.getFrom());
            if (StringUtils.isNotBlank(emailProperties.getReplyTo())) {
                helper.setReplyTo(emailProperties.getReplyTo());
            }
            helper.setValidateAddresses(emailProperties.isValidateAddresses());
            helper.setPriority(1);

            if (StringUtils.isNotBlank(emailProperties.getCc())) {
                helper.setCc(emailProperties.getCc());
            }

            if (StringUtils.isNotBlank(emailProperties.getBcc())) {
                helper.setBcc(emailProperties.getBcc());
            }
            this.mailSender.send(message);
            return true;
        } catch (final Exception ex) {
            LOGGER.error(ex.getMessage(), ex);
        }
        return false;
    }
520701
public Message message(String subject, String messageBody) {
        Collection<Member> recipients = new ArrayList<Member>();
        return message(subject, messageBody, recipients);
    }
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();
    }
391828
public void sendWithAttachment(String subject, 
                                 String textBody,
                                 String attachmentType,
                                 String attachmentName,
                                 InputStream is)
  {
    try {
      MimeMessage msg = new MimeMessage(getSession());

      if(_from.length > 0)
        msg.addFrom(_from);
      msg.addRecipients(RecipientType.TO, _to);
      if(subject != null)
        msg.setSubject(subject);
      
      // msg.setContent(textBody, "multipart/mime");
      
      MimeMultipart multipart = new MimeMultipart();
      
      MimeBodyPart textBodyPart = new MimeBodyPart();
      textBodyPart.setText(textBody);
      multipart.addBodyPart(textBodyPart);
      
      ByteArrayOutputStream bos = new ByteArrayOutputStream();
      TempBuffer tb = TempBuffer.create();
      byte []buffer = tb.buffer();
      int len;
      
      while ((len = is.read(buffer, 0, buffer.length)) >= 0) {
        bos.write(buffer, 0, len);
      }
      bos.close();
      byte []content = bos.toByteArray();
      TempBuffer.free(tb);
      
      DataSource dataSource
        = new ByteArrayDataSource(content, attachmentType);
      
      MimeBodyPart pdfBodyPart = new MimeBodyPart();
      pdfBodyPart.setDataHandler(new DataHandler(dataSource));
      pdfBodyPart.setFileName(attachmentName);
      multipart.addBodyPart(pdfBodyPart);
      
      msg.setContent(multipart);

      send(msg);
    } catch (RuntimeException e) {
      throw e;
    } catch (Exception e) {
      throw new RuntimeException(e);
    }
  }
857698
public function sendMail($to, $subject = '', $message = '', $headers = '')
    {
        if (empty($headers)) {
            $headers = 'From: ' . APP_SYS_EMAIL;
        }
        mail($to, $subject, $message, $headers);
    }
621127
public static void sendMail(String host, String personal, String to, String title, String content,
                                final String from, final String key) throws Exception {
        setHost(host);
        setPersonal(personal);
        sendMail(to, title, content, from, key);
    }
928948
private void email(JsonSimple response, String oid, String text) {
		JsonObject object = newMessage(response,
				EmailNotificationConsumer.LISTENER_ID);
		JsonObject message = (JsonObject) object.get("message");
		message.put("to", emailAddress);
		message.put("body", text);
		message.put("oid", oid);
	}
871511
public Task<AwsSesSendResult> sendEmail(
      @NonNull final String to,
      @NonNull final String from,
      @NonNull final String subject,
      @NonNull final String body) {
    return dispatcher.dispatchTask(new Callable<AwsSesSendResult>() {
      @Override
      public AwsSesSendResult call() {
        return proxy.sendEmail(to, from, subject, body);
      }
    });
  }
869885
protected function sendViaEmail($source, $from, $to, $subject, $body) {
		$email = new Email($from, $to, $subject, $body);
		if($source->getDryRun()) {
			$source->log("[Skipped] Sent message to $to (subject: $subject)");
		} else {
			$email->sendPlain();
			$source->log("Sent message to $to (subject: $subject)");
		}
	}
1319945
public static void sendTextEmail(String to, String from, String subject, String msg, final ServerSetup setup) {
        sendMimeMessage(createTextEmail(to, from, subject, msg, setup));
    }
926548
public function send($mailAddress, $username, $subject, $body)
    {
        $subject = $this->translator->trans($subject);
        $body = $this->translator->trans(
            $body,
            ['%username%' => $username]
        );

        $message = $this->messageFactory->create();
        $message
            ->setSubject($subject)
            ->setFrom($this->mailerAddress)
            ->setTo($mailAddress)
            ->setBody($body);

        return $this->mailer->send($message);
    }