Parse an outgoing mail and put it into the OUTBOX.


    Arguments:
    - `sender`: str
    - `to`: str
    - `msgstring`: str

    Return: None
    Exceptions: None
557930
def _parse_outgoing_mail(sender, to, msgstring):
    
    global OUTBOX
    OUTBOX.append(email.message_from_string(msgstring))
    return
1067465
def email_user(
        self, subject, message, from_email=settings.DEFAULT_FROM_EMAIL, **kwargs
    ):
        
        receiver = self.email
        if settings.EMAIL_OVERRIDE_ADDRESS:
            receiver = settings.EMAIL_OVERRIDE_ADDRESS

        send_mail(subject, message, from_email, [receiver], **kwargs)
361092
def send(self, sender: PytgbotApiBot):
        
        return sender.send_invoice(
            # receiver, self.media, disable_notification=self.disable_notification, reply_to_message_id=reply_id
            title=self.title, description=self.description, payload=self.payload, provider_token=self.provider_token, start_parameter=self.start_parameter, currency=self.currency, prices=self.prices, chat_id=self.receiver, reply_to_message_id=self.reply_id, provider_data=self.provider_data, photo_url=self.photo_url, photo_size=self.photo_size, photo_width=self.photo_width, photo_height=self.photo_height, need_name=self.need_name, need_phone_number=self.need_phone_number, need_email=self.need_email, need_shipping_address=self.need_shipping_address, send_phone_number_to_provider=self.send_phone_number_to_provider, send_email_to_provider=self.send_email_to_provider, is_flexible=self.is_flexible, disable_notification=self.disable_notification, reply_markup=self.reply_markup
        )
1313005
def toDict(self, msg: Dict) -> Dict:
        

        if isinstance(msg, Request):
            tmsg = msg.as_dict
        elif hasattr(msg, "_asdict"):
            tmsg = dict(msg._asdict())
        elif hasattr(msg, "__dict__"):
            tmsg = dict(msg.__dict__)
        elif self.allowDictOnly:
            raise ValueError("Message cannot be converted to an appropriate "
                             "format for transmission")
        else:
            tmsg = msg
        return tmsg
14019
def sender(self, jid: str):
        
        if jid is not None and not isinstance(jid, str):
            raise TypeError("'sender' MUST be a string")
        self._sender = aioxmpp.JID.fromstr(jid) if jid is not None else None
1059343
def send(self, message, envelope_from=None):
        
        assert message.send_to, "No recipients have been added"

        assert message.sender, (
            "The message does not specify a sender and a default sender "
            "has not been configured")

        if message.has_bad_headers():
            raise BadHeaderError

        if message.date is None:
            message.date = time.time()

        ret = None
        if self.host:
            ret = self.host.sendmail(
                sanitize_address(envelope_from or message.sender),
                list(sanitize_addresses(message.send_to)),
                message.as_bytes() if PY3 else message.as_string(),
                message.mail_options,
                message.rcpt_options
            )

        email_dispatched.send(message, app=current_app._get_current_object())

        self.num_emails += 1

        if self.num_emails == self.mail.max_emails:
            self.num_emails = 0
            if self.host:
                self.host.quit()
                self.host = self.configure_host()

        return ret
785098
def from_file(cls, fp, is_outlook=False):
        
        log.debug("Parsing email from file {!r}".format(fp))

        with ported_open(fp) as f:
            message = email.message_from_file(f)

        if is_outlook:
            log.debug("Removing temp converted Outlook email {!r}".format(fp))
            os.remove(fp)

        return cls(message)
577951
def email(sender=None, receivers=(), cc=(), bcc=(),
          subject=None, content=None, encoding='utf8',
          attachments=()):
    
    enclosure = [HTML(content, encoding)]
    enclosure.extend(Attachment(k) for k in attachments)
    return Collection(
        *enclosure,
        headers=[
            headers.subject(subject),
            headers.sender(sender),
            headers.to(*receivers),
            headers.cc(*cc),
            headers.bcc(*bcc),
            headers.date(),
            headers.message_id(),
        ]
    )
305150
def message_me(msg)
			@msg = msg
			mail from: @msg.email, subject: @msg.subject, body: @msg.content
		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
533691
def _parse_message_to_mqtt(self, data):
        
        msg = Message(data, self)
        payload = str(msg.payload)
        msg.payload = ''
        # prefix/node/child/type/ack/subtype : payload
        return ('{}/{}'.format(self._out_prefix, msg.encode('/'))[:-2],
                payload, msg.ack)
1322395
def sender(self, value):
        
        if isinstance(value, Recipient):
            if value._parent is None:
                value._parent = self
                value._field = 'from'
            self.__sender = value
        elif isinstance(value, str):
            self.__sender.address = value
            self.__sender.name = ''
        else:
            raise ValueError(
                'sender must be an address string or a Recipient object')
        self._track_changes.add('from')
589674
def send_email(fromaddr, toaddr, subject, message):
    
    from smtplib import SMTP
    from email.mime.text import MIMEText

    SERVER = "localhost"
    _message = MIMEText(message)
    _message['Subject'] = subject
    _message['From'] = fromaddr
    _message['To'] = ", ".join(toaddr)

    server = SMTP(SERVER)
    server.sendmail(fromaddr, toaddr, _message.as_string())
    server.quit()
618438
def _extract_sender(
    message: Message, resent_dates: List[Union[str, Header]] = None
) -> str:
    
    if resent_dates:
        sender_header = "Resent-Sender"
        from_header = "Resent-From"
    else:
        sender_header = "Sender"
        from_header = "From"

    # Prefer the sender field per RFC 2822:3.6.2.
    if sender_header in message:
        sender = message[sender_header]
    else:
        sender = message[from_header]

    return str(sender) if sender else ""
1174473
def Emailer(recipients, sender=None):
    
    import smtplib
    hostname = socket.gethostname()
    if not sender:
        sender = 'lggr@{0}'.format(hostname)
    smtp = smtplib.SMTP('localhost')
    try:
        while True:
            logstr = (yield)
            try:
                smtp.sendmail(sender, recipients, logstr)
            except smtplib.SMTPException:
                pass
    except GeneratorExit:
        smtp.quit()
271695
def send(self, msg):
        """"""
        assert isinstance(msg, str), "String is required"

        if self._debug:
            log.info("outgoing message: %s, %s", self.id, str(msg)[:200])

        if self.state != STATE_OPEN:
            return

        self._feed(FRAME_MESSAGE, msg)
947693
def from_email(self, value):
        
        if isinstance(value, str):
            value = From(value, None)
        if isinstance(value, tuple):
            value = From(value[0], value[1])
        self._from_email = value