almost same as mailflute
1606
protected SqlAnalyzer createSqlAnalyzer(String templateText, boolean blockNullParameter) {
        final SqlAnalyzer analyzer = new SqlAnalyzer(templateText, blockNullParameter) {
            @Override
            protected String filterAtFirst(String sql) {
                return sql; // keep body
            }

            @Override
            protected EmbeddedVariableNode newEmbeddedVariableNode(String expr, String testValue, String specifiedSql,
                    boolean blockNullParameter, NodeAdviceFactory adviceFactory, boolean replaceOnly, boolean terminalDot,
                    boolean overlookNativeBinding) {
                return createTemplikeEmbeddedVariableNode(expr, testValue, specifiedSql, blockNullParameter, adviceFactory, replaceOnly,
                        terminalDot, overlookNativeBinding);
            }
        }.overlookNativeBinding().switchBindingToReplaceOnlyEmbedded(); // adjust for plain template
        return analyzer;
    }
345738
def loop(self):
        
        for mail in Mail.objects.filter(done=False, send_fail_count__lt=3):
            # send all emails that are not already send or failed to send less
            # then three times
            mail.send_mail()

        for mail in Mail.objects.filter(done=True, timestamp__lt=time() - 60 * 60 * 24 * 7):
            # delete all done emails older then one week
            mail.delete()
        return 1, None
629216
def CorrectWrongEmails(self, askInput=True):
        ''''''
        for email in self.wrong_emails:
            corrected_email = self.CorrectEmail(email)
            self.emails[self.emails.index(email)] = corrected_email

        self.wrong_emails = []
1131181
def email_list(mail)
      [mail.to, mail.bcc, mail.cc].flatten.uniq.compact
    end
538051
def dump_emails(part):
    """"""

    print("Sent emails:")
    for email in mail.outbox:
        print(getattr(email, part))
1282170
function doAutoLinks(text) {

        text = text.replace(/<((https?|ftp|dict):[^'">\s]+)>/gi,"<a href=\"$1\">$1</a>");
        text = text.replace(/<(?:mailto:)?([-.\w]+\@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi, function(wholeMatch,m1) {
            return encodeEmailAddress(unescapeSpecialChars(m1));
        });

        return text;
    }
881762
function ImapSimple(imap) {
    var self = this;
    self.imap = imap;

    // flag to determine whether we should suppress ECONNRESET from bubbling up to listener
    self.ending = false;

    // pass most node-imap `Connection` events through 1:1
    ['alert', 'mail', 'expunge', 'uidvalidity', 'update', 'close', 'end'].forEach(function (event) {
        self.imap.on(event, self.emit.bind(self, event));
    });

    // special handling for `error` event
    self.imap.on('error', function (err) {
        // if .end() has been called and an 'ECONNRESET' error is received, don't bubble
        if (err && self.ending && (err.code.toUpperCase() === 'ECONNRESET')) {
            return;
        }

        self.emit('error', err);
    });
}
185462
def preview_to(recipient)
      @newsletter = build_newsletter
      mail = build_mail
      mail.to = recipient.email
      replace_and_send_mail_safely(mail, recipient)
    end
881278
def send(self, **extra):
        
        emails = self.as_dict(**extra)
        responses = [self._manager._send_batch(*batch) for batch in chunks(emails, self.MAX_SIZE)]
        return sum(responses, [])
648610
def mail_container(value):
    
    if not re.match(r'.*://.*', value):
        raise VdtTypeError(value)
    mburl = urlparse(value)
    uri_scheme_to_mbclass = {
            'mbox': mailbox.mbox,
            'maildir': mailbox.Maildir,
            'mh': mailbox.MH,
            'babyl': mailbox.Babyl,
            'mmdf': mailbox.MMDF,
        }
    klass = uri_scheme_to_mbclass.get(mburl.scheme)
    if klass:
        return klass(mburl.netloc + mburl.path)
    raise VdtTypeError(value)
49722
def check_quirks
    return unless @conn &&
        @conn.greeting.kind_of?(Net::IMAP::UntaggedResponse) &&
        @conn.greeting.data.kind_of?(Net::IMAP::ResponseText)

    if @conn.greeting.data.text =~ /^Gimap ready/
      @quirks[:gmail] = true
      debug "looks like Gmail"

    elsif host =~ /^imap(?:-ssl)?\.mail\.yahoo\.com$/
      @quirks[:yahoo] = true
      debug "looks like Yahoo! Mail"
          
    elsif host =~ /emailsrvr\.com/
      @quirks[:rackspace] = true
      debug "looks like Rackspace Mail"
    end
  end
875902
public void cloneTo (@Nonnull final PDContact ret)
  {
    ret.m_sEmail = m_sEmail;
    ret.m_sName = m_sName;
    ret.m_sPhoneNumber = m_sPhoneNumber;
    ret.m_sType = m_sType;
  }
110533
def replace_and_send_mail_safely(mail, recipient)
      html_body = mail.html_part.body.raw_source
      do_custom_replacements_for(mail, recipient)
      send_raw_email_safely(mail)
      mail.html_part.body = html_body
    end
1223804
function sendEmailToServer(formName){
  var email = $('#' + formName + ' [name=ep_email]').val();
  var userId = pad.getUserId();
  var message = {};
  message.type = 'USERINFO_UPDATE';
  message.userInfo = {};
  message.padId = pad.getPadId();
  message.userInfo.email = email;
  message.userInfo.email_option = $('#' + formName + ' [name=ep_email_option]').val();
  message.userInfo.email_onStart = $('#' + formName + ' [name=ep_email_onStart]').is(':checked');
  message.userInfo.email_onEnd = $('#' + formName + ' [name=ep_email_onEnd]').is(':checked');
  message.userInfo.formName = formName;
  message.userInfo.userId = userId;
  if(email){
    pad.collabClient.sendMessage(message);
  }
}
1154512
def spasser(inbox, s=None):
    
    seq = (s or range(len(inbox)))
    return [input_ for i, input_ in enumerate(inbox) if i in seq]
340456
def sendgmail(self, subject, recipients, plaintext, htmltext=None, cc=None, debug=False, useMIMEMultipart=True, gmail_account = 'kortemmelab@gmail.com', pw_filepath = None):
        ''''''
        smtpserver = smtplib.SMTP("smtp.gmail.com", 587)
        smtpserver.ehlo()
        smtpserver.starttls()
        smtpserver.ehlo
        gmail_account = 'kortemmelab@gmail.com'
        if pw_filepath:
            smtpserver.login(gmail_account, read_file(pw_filepath))
        else:
            smtpserver.login(gmail_account, read_file('pw'))
        for recipient in recipients:

            if htmltext:
                msg = MIMEText(htmltext, 'html')
                msg['From'] = gmail_account
                msg['To'] = recipient
                msg['Subject'] = subject
                smtpserver.sendmail(gmail_account, recipient, msg.as_string())
            else:
                header = 'To:' + recipient + '\n' + 'From: ' + gmail_account + '\n' + 'Subject:' + subject + '\n'
                msg = header + '\n ' + plaintext + '\n\n'
                smtpserver.sendmail(gmail_account, recipient, msg)
        smtpserver.close()
1141366
def get_random_email(ltd="com"):
        

        email = [
            RandomInputHelper.get_random_value(6, [string.ascii_lowercase]),
            "@",
            RandomInputHelper.get_random_value(6, [string.ascii_lowercase]),
            ".",
            ltd
        ]

        return "".join(email)