Send Emails using mandrill api
 @param [Text] email Email Address of the receiver
 @param [Text] subject Subject of Email
 @param [Hash] opt Hash contain other message details
337169
def send(email, subject, opts = {})
      if email.nil? or subject.nil?
        raise ArgumentError, 'Email Address or Subject is missing'
      else
        message = {
          from_name: Octo.get_config(:email_sender).fetch(:name),
          from_email: Octo.get_config(:email_sender).fetch(:email),

          subject: subject,

          text: opts.fetch('text', nil),
          html: opts.fetch('html', nil),

          to: [{
            email: email,
            name: opts.fetch('name', nil)
          }]
        }
        # Pass the message to resque only when mandrill key is present
        _mandrill_config = ENV['MANDRILL_API_KEY'] || Octo.get_config(:mandrill_api_key)
        if _mandrill_config and !_mandrill_config.empty?
          enqueue_msg(message)
        end
      end
    end
1228003
def send_mail(subject, message, from_email, recipient_list, html_message='',
              scheduled_time=None, headers=None, priority=PRIORITY.medium):
    

    subject = force_text(subject)
    status = None if priority == PRIORITY.now else STATUS.queued
    emails = []
    for address in recipient_list:
        emails.append(
            Email.objects.create(
                from_email=from_email, to=address, subject=subject,
                message=message, html_message=html_message, status=status,
                headers=headers, priority=priority, scheduled_time=scheduled_time
            )
        )
    if priority == PRIORITY.now:
        for email in emails:
            email.dispatch()
    return emails
893551
async def send_mail(
        self, sender, recipients, message, mail_options=None, rcpt_options=None
    ):
        
        return await self.sendmail(
            sender, recipients, message, mail_options, rcpt_options
        )
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);
  }
305150
def message_me(msg)
			@msg = msg
			mail from: @msg.email, subject: @msg.subject, body: @msg.content
		end
1185579
def __search_email_by_subject(self, subject, match_recipient):
        ""
        if match_recipient is None:
            _, data = self._mail.uid('search',
                                     None,
                                     '(HEADER SUBJECT "{subject}")'
                                     .format(subject=subject))

            uid_list = data[0].split()
            return uid_list
        else:
            _, data = self._mail.uid('search',
                                     None,
                                     '(HEADER SUBJECT "{subject}" TO "{recipient}")'
                                     .format(subject=subject, recipient=match_recipient))

            filtered_list = []
            uid_list = data[0].split()
            for uid in uid_list:
                # Those hard coded indexes [1][0][1] is a hard reference to the message email message headers
                # that's burried in all those wrapper objects that's associated
                # with fetching a message.
                to_addr = re.search(
                    "[^-]To: (.*)", self._mail.uid('fetch', uid, "(RFC822)")[1][0][1]).group(1).strip()

                if (to_addr == match_recipient or to_addr == "<{0}>".format(match_recipient)):
                    # Add matching entry to the list.
                    filtered_list.append(uid)

            return filtered_list
1259021
def send_error_email(subject, message, additional_recipients=None):
    
    recipients = _email_recipients(additional_recipients)
    sender = email().sender
    send_email(
        subject=subject,
        message=message,
        sender=sender,
        recipients=recipients
    )
945745
def async_mail_task(subject_or_message, to=None, template=None, **kwargs):
    
    to = to or kwargs.pop('recipients', [])
    msg = make_message(subject_or_message, to, template, **kwargs)
    with mail.connect() as connection:
        connection.send(msg)
99605
def send_mass_template_mail(subject_template, body_template, recipients, context=None):
    
    if context:
        subject, body = render_mail_template(subject_template, body_template, context)
    else:
        subject, body = subject_template, body_template

    message_tuples = [(subject, body, conf.get('DEFAULT_FROM_EMAIL'), [r]) for r in recipients]

    send_mass_mail(message_tuples)
722474
public function sendEmail($subject, $view, $vars = [])
    {
        $vars['email'] = $email = $this->email;
        $vars['username'] = $username = $this->username;

        Mail::queue(['text' => $view], $vars, function ($message) use ($email, $username, $subject) {
            $message->subject($subject)->to($email, $username);

            if (config()->has('mail.reply_to')) {
                $message->replyTo(
                    config('mail.reply_to.email'),
                    config('mail.reply_to.name')
                );
            }
        });
    }
175434
def send_mail(subject, body, email_from, emails_to):
    
    msg = MIMEText(body)
    msg['Subject'] = subject
    msg['From'] = email_from
    msg['To'] = ", ".join(emails_to)
    s = smtplib.SMTP('smtp.gmail.com', 587)
    s.ehlo()  # for tls add this line
    s.starttls()  # for tls add this line
    s.ehlo()  # for tls add this line
    s.login(SMTP_USERNAME, SMTP_PASSWORD)
    s.sendmail(email_from, emails_to, msg.as_string())
    s.quit()
113231
def fetch_plaintext_by_subject(self, email_name):
        
        if not email_name:
            raise EmailException("Subject cannot be null")

        results = self.__imap_search(SUBJECT=email_name)
        sources = self.fetch_plaintext(results)

        return sources
231592
def send_mail
      return unless @options[:email]
      @log.info "Emailing #{@options[:email]}..."
      begin
        RDSBackup::Email.new(self).send!
        @log.info "Email sent to #{@options[:email]} for job #{backup_id}"
      rescue Exception => e
        @log.warn "Error sending email: #{e.message.split("\n").first}"
      end
    end
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)
414192
public void sendMail (String to, String subject, String content) throws MessagingException {
        Properties props = new Properties();
        props.put("mail.smtp.user", emailConfg.getUser());
        props.put("mail.smtp.host", emailConfg.getHost());
        props.put("mail.smtp.port", emailConfg.getPort());
        props.put("mail.smtp.starttls.enable","true");
        props.put("mail.smtp.debug", emailConfg.getDebug());
        props.put("mail.smtp.auth", emailConfg.getAuth());
        props.put("mail.smtp.ssl.trust", emailConfg.host);

        SMTPAuthenticator auth = new SMTPAuthenticator(emailConfg.getUser(), (String)secret.get(SecretConstants.EMAIL_PASSWORD));
        Session session = Session.getInstance(props, auth);

        MimeMessage message = new MimeMessage(session);

        message.setFrom(new InternetAddress(emailConfg.getUser()));
        message.addRecipient(Message.RecipientType.TO, new InternetAddress(to));

        message.setSubject(subject);

        message.setContent(content, "text/html");

        // Send message
        Transport.send(message);
        if(logger.isInfoEnabled()) logger.info("An email has been sent to " + to + " with subject " + subject);
    }
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()
1238964
function send_mail(opts) {
	var Q = require('q');
	var nodemailer = require("nodemailer");

	var smtpTransport = nodemailer.createTransport("SMTP", config.smtp);
	
	// setup e-mail data with unicode symbols
	var mailOptions = {
		from: opts.from,
		to: opts.to,
		subject: opts.subject,
		text: opts.text,
		html: opts.html
	};
	
	// send mail with defined transport object
	var defer = Q.defer();
	try {
		util.debug('Calling smtpTransport.sendMail()...');
		smtpTransport.sendMail(mailOptions, function(error, response){
			util.debug('End of smtpTransport.sendMail()');
			if(error){
				defer.reject(error);
				return;
			}
			defer.resolve(response);
		});
	} catch(err) {
		defer.reject(err);
	}
	return defer.promise.fin(function() { smtpTransport.close(); });
}