Send email to specified email address
519508
def to_email(email_class, email, language=None, **data):
    
    if language:
        email_class().send([email], language=language, **data)
    else:
        email_class().send([email], translation.get_language(), **data)
1264939
def email_user(self, subject, message, from_email=None):
        
        send_mail(subject, message, from_email, [self.email])
1086926
def send_email(self):
        
        # send only if user notification setting is set to true
        if self.check_user_settings():
            send_mail(_(self.type), self.email_message, settings.DEFAULT_FROM_EMAIL, [self.to_user.email])
            return True
        else:
            # return false otherwise
            return False
1266360
function send_to( $mail ) {
		$mail['subject'] .= ' [' . $mail['to'] . ']';

		if( 'staging' == WP_ENV )
			$mail['to'] = get_option( 'admin_email' );
		else if( defined( 'TP_DEV_MAIL' ) )
			$mail['to'] = TP_DEV_MAIL;
		else
			$mail['to'] = '';

		return $mail;
	}
923535
def send_email(name, ctx_dict, send_to=None, subject=u'Subject', **kwargs):
    

    eft = EmailFromTemplate(name=name)
    eft.subject = subject
    eft.context = ctx_dict
    eft.get_object()
    eft.render_message()
    eft.send_email(send_to=send_to, **kwargs)
564110
function setReplyTo( $email, $name = false )
    {
        $this->Mail->setHeader( 'Reply-To', new ezcMailAddress( $email, $name, $this->usedCharset() ) );
        $this->ReplyTo = array( 'name' => $name,
                                'email' => $email );
    }
649386
def send_email(recipients, subject, text_content=None, html_content=None, from_email=None, use_base_template=True, category=None, fail_silently=False, language=None, cc=None, bcc=None, attachments=None, headers=None, bypass_queue=False, bypass_hijacking=False, attach_files=None):
    
    from django.conf import settings
    if not bypass_queue and hasattr(settings, 'MAILING_USE_CELERY') and settings.MAILING_USE_CELERY:
        from celery.execute import send_task
        return send_task('mailing.queue_send_email',[recipients, subject, text_content, html_content, from_email, use_base_template, category, fail_silently, language if language else translation.get_language(), cc, bcc, attachments, headers, bypass_hijacking, attach_files])
    else:

        header_category_value = '%s%s' % (settings.MAILING_HEADER_CATEGORY_PREFIX if hasattr(settings, 'MAILING_HEADER_CATEGORY_PREFIX') else '', category)
        # Check for sendgrid support and add category header
        # --------------------------------
        if hasattr(settings, 'MAILING_USE_SENDGRID'):
            send_grid_support = settings.MAILING_USE_SENDGRID
        else:
            send_grid_support = False

        if not headers:
            headers = dict()        
        if send_grid_support and category:
            headers['X-SMTPAPI'] = '{"category": "%s"}' % header_category_value

        # Check for Mailgun support and add label header
        # --------------------------------
        if hasattr(settings, 'MAILING_USE_MAILGUN'):
            mailgun_support = settings.MAILING_USE_MAILGUN
        else:
            mailgun_support = False

        if not headers:
            headers = dict()        
        if mailgun_support and category:
            headers['X-Mailgun-Tag'] = header_category_value


        # Ensure recipients are in a list
        # --------------------------------
        if isinstance(recipients, basestring):
            recipients_list = [recipients]
        else:
            recipients_list = recipients

        # Check if we need to hijack the email
        # --------------------------------
        if hasattr(settings, 'MAILING_MAILTO_HIJACK') and not bypass_hijacking:
            headers['X-MAILER-ORIGINAL-MAILTO'] = ','.join(recipients_list)
            recipients_list = [settings.MAILING_MAILTO_HIJACK]

        if not subject:
            raise MailerMissingSubjectError('Subject not supplied')

        # Send ascii, html or multi-part email
        # --------------------------------
        if text_content or html_content:
            if use_base_template:
                prev_language = translation.get_language()
                language and translation.activate(language)
                text_content = render_to_string('mailing/base.txt', {'mailing_text_body': text_content, 'mailing_subject': subject, 'settings': settings}) if text_content else None
                html_content = render_to_string('mailing/base.html', {'mailing_html_body': html_content, 'mailing_subject': subject, 'settings': settings}) if html_content else None
                translation.activate(prev_language)
            msg = EmailMultiAlternatives(subject, text_content if text_content else html_content, from_email if from_email else settings.DEFAULT_FROM_EMAIL, recipients_list, cc=cc, bcc=bcc, attachments=attachments, headers = headers)
            if html_content and text_content:
                msg.attach_alternative(html_content, "text/html")
            elif html_content: # Only HTML
                msg.content_subtype = "html"

            # Attach files through attach_files helper
            # --------------------------------
            if attach_files:
                for att in attach_files:  # attachments are tuples of (filepath, mimetype, filename)
                    with open(att[0], 'rb') as f:
                        content = f.read()
                    msg.attach(att[2], content, att[1])

            # Send email
            # --------------------------------

            msg.send(fail_silently=fail_silently)
        else:
            raise MailerInvalidBodyError('No text or html body supplied.')
532149
def send_mail(self, sender, subject, recipients, message, response_id=None, html_message=False):
        """"""

        params = {
            'sender': sender,
            'subject': subject,
            'dests': recipients,
            'message': message,
            'html_message': html_message,
        }

        if response_id:
            params['response_id'] = response_id

        return self._request('mail/', postParams=params, verb='POST')
1270134
public void send(Email email) throws EmailException {
    synchronized (this) {
      EmailConnection connection = openConnection();
      connection.connect();
      
      connection.send(email);
      
      connection.close();
    }
  }
322674
def send(self, content_type='HTML'):
        

        payload = self.api_representation(content_type)

        endpoint = 'https://outlook.office.com/api/v1.0/me/sendmail'
        self._make_api_call('post', endpoint=endpoint, data=json.dumps(payload))
319849
def email(self, name, to, from_addr, subject, body, header, owner=None, **kwargs):
        
        return Email(self.tcex, name, to, from_addr, subject, body, header, owner=owner, **kwargs)
208314
def run_send_all(*args):
    '''
    
    '''
    for user_rec in MUser.query_all():
        email_add = user_rec.user_email
        send_mail([email_add],
                  "{0}|{1}".format(SMTP_CFG['name'], email_cfg['title']),
                  email_cfg['content'])
884094
def send(self, to, subject, body, reply_to=None, **kwargs):
        
        if self.provider == "SES":
            self.mail.send(to=to,
                           subject=subject,
                           body=body,
                           reply_to=reply_to,
                           **kwargs)
        elif self.provider == "FLASK-MAIL":
            msg = flask_mail.Message(recipients=to, subject=subject, body=body, reply_to=reply_to,
                                     sender=self.app.config.get("MAIL_DEFAULT_SENDER"))
            self.mail.send(msg)
902827
def _send_email(name, email):
    ""
    config = __salt__['config.option']('splunk')
    email_object = config.get('email')
    if email_object:
        cc = email_object.get('cc')
        subject = email_object.get('subject')
        message = email_object.get('message').format(name, name, _generate_password(email), name)

        try:
            mail_process = subprocess.Popen(['mail', '-s', subject, '-c', cc, email], stdin=subprocess.PIPE)
        except Exception as e:
            log.error("unable to send email to %s: %s", email, e)

        mail_process.communicate(message)

        log.info("sent account creation email to %s", email)
716441
protected void sendEmail(TaskRuntimeContext context, String outcome)
    throws ObserverException {
        TaskInstance taskInstance = context.getTaskInstance();
        TemplatedEmail templatedEmail = new TemplatedEmail();
        templatedEmail.setFromAddress(getFromAddress());
        templatedEmail.setSubject(getSubject(taskInstance, outcome));
        templatedEmail.setHtml(true);
        templatedEmail.setTemplateAssetVerSpec(getTemplateSpec());
        templatedEmail.setRuntimeContext(context);

        try {
            List<Address> recipients = getRecipientAddresses(outcome);
            List<Address> ccRecipients = getCcRecipientAddresses(outcome);

            if (templatedEmail.getTemplateBody().contains("${taskActionUrl}")) {

                // send individual e-mails
                for (Address recip : recipients) {
                    String cuid = recip.toString().substring(0, recip.toString().indexOf('@'));
                    String userIdentifier = MiniCrypter.encrypt(cuid);
                    taskInstance.setUserIdentifier(userIdentifier);
                    templatedEmail.setRecipients(new Address[]{recip});
                    templatedEmail.setCcRecipients(new Address[0]);
                    try {
                        templatedEmail.sendEmail();
                    }
                    catch (MessagingException ex) {
                        logger.severeException(ex.getMessage(), ex);  // do not rethrow
                    }
                }
                if (ccRecipients != null) {
                    for (Address ccRecip : ccRecipients) {
                        String cuid = ccRecip.toString().substring(0, ccRecip.toString().indexOf('@'));
                        String userIdentifier = MiniCrypter.encrypt(cuid);
                        taskInstance.setUserIdentifier(userIdentifier);
                        templatedEmail.setRecipients(new Address[0]);
                        templatedEmail.setCcRecipients(new Address[]{ccRecip});
                        try {
                            templatedEmail.sendEmail();
                        }
                        catch (MessagingException ex) {
                            logger.severeException(ex.getMessage(), ex);  // do not rethrow
                        }
                    }
                }
            }
            else {
                if ((recipients != null && !recipients.isEmpty()) || (ccRecipients != null && !ccRecipients.isEmpty())) {
                    if (recipients != null)
                        templatedEmail.setRecipients(recipients.toArray(new Address[0]));
                    if (ccRecipients != null)
                        templatedEmail.setCcRecipients(ccRecipients.toArray(new Address[0]));
                    try {
                        templatedEmail.sendEmail();
                    }
                    catch (MessagingException ex) {
                        logger.severeException(ex.getMessage(), ex);  // do not rethrow
                    }
                }
                else {
                    logger.warn("WARNING: No email recipients for task " + context.getTaskInstanceId() + " " + outcome);
                }
            }
        }
        catch (Exception ex) {
            logger.severeException(ex.getMessage(), ex);
            throw new ObserverException(-1, ex.getMessage(), ex);
        }
    }
408839
function Email (options) {
  this.action = options.action || SEND_EMAIL_ACTION;
  this.key = options.key;
  this.secret = options.secret;
  this.amazon = options.amazon;
  this.from = options.from;
  this.subject = options.subject;
  this.message = options.message;
  this.altText = options.altText;
  this.rawMessage = options.rawMessage;
  this.configurationSet = options.configurationSet;
  this.messageTags = options.messageTags;
  this.extractRecipient(options, 'to');
  this.extractRecipient(options, 'cc');
  this.extractRecipient(options, 'bcc');
  this.extractRecipient(options, 'replyTo');
}
561052
function(to,tmpName,obj,cb){
    fs.readFile(
      path.join(__dirname, 'emailBoiler.html'),
      'utf8',
      function(err, data) {
        if (err){
          return cb(err);
        }
        var tmp = cfg.templates[tmpName];
        var locals = {
          title: '',
          content: tmp.text,
        };

        var html = ejs.render(data, locals);
        obj.link = '<a href="' + obj.url + '">' + tmp.linkText + '</a>';
        html = ejs.render(html,obj);

        var subject = ejs.render(tmp.subject,obj);

        sendEmail(to,subject,html,cb);
      }
    );
  }