Retrieve raw email dump for this bounce.

        :param sender: A :class:`BounceDump` object to get dump with.
            Defaults to `None`.
        :param \*\*kwargs: Keyword arguments passed to
            :func:`requests.request`.
550507
def dump(self, sender=None, **kwargs):
        '''
        '''
        if sender is None:
            if self._sender is None:
                sender = _default_bounce_dump
            else:
                sender = BounceDump(api_key=self._sender.api_key,
                                    test=self._sender.test,
                                    secure=self._sender.secure)
        return sender.get(self.id, **kwargs)
823826
def pickle_dumps(inbox):
    
    # http://bugs.python.org/issue4074
    gc.disable()
    str_ = cPickle.dumps(inbox[0], cPickle.HIGHEST_PROTOCOL)
    gc.enable()
    return str_
209335
def _raw_recv(self):
        
        with self.lock:
            if self._index >= len(self._buffer):
                self._mcon()
            if self._index >= 199:
                self._resetbuffer()
                self._mcon()
            msg = self._buffer[self._index]
            while self.find(msg, 'PING :'):
                self._index += 1
                try:
                    msg = self._buffer[self._index]
                except IndexError:
                    self._mcon()
                    self.stepback(append=False)

            self._index += 1
            return msg
899287
def get_recipient_data
      puts "Enter the recipient's email address:"
      while @to_address = gets.chomp
        catch :badto do
          if ValidateEmail.validate(@to_address) == true
            puts "Is the recipient's email address #{@to_address}? [y/n]:"
            while to_address_confirmation = gets.chomp
              case to_address_confirmation
              when 'y'
                return
              else
                puts "Please re-enter the recipient's email address:"
                throw :badto
              end
            end
          else
            puts "Email invalid! Please enter a valid email address:"
          end
        end
      end
    end
453076
def get_mailbox(self, email=None, email_hash=None):
        
        if email is None:
            email = self.get_email_address()
        if email_hash is None:
            email_hash = self.get_hash(email)

        url = 'http://{0}/request/mail/id/{1}/format/json/'.format(
            self.api_domain, email_hash)
        req = requests.get(url)
        return req.json()
1265883
def process_bounce(message, notification):
    """"""
    mail = message['mail']
    bounce = message['bounce']

    bounces = []
    for recipient in bounce['bouncedRecipients']:
        # Create each bounce record. Add to a list for reference later.
        bounces += [Bounce.objects.create(
            sns_topic=notification['TopicArn'],
            sns_messageid=notification['MessageId'],
            mail_timestamp=clean_time(mail['timestamp']),
            mail_id=mail['messageId'],
            mail_from=mail['source'],
            address=recipient['emailAddress'],
            feedback_id=bounce['feedbackId'],
            feedback_timestamp=clean_time(bounce['timestamp']),
            hard=bool(bounce['bounceType'] == 'Permanent'),
            bounce_type=bounce['bounceType'],
            bounce_subtype=bounce['bounceSubType'],
            reporting_mta=bounce.get('reportingMTA'),
            action=recipient.get('action'),
            status=recipient.get('status'),
            diagnostic_code=recipient.get('diagnosticCode')
        )]

    # Send signals for each bounce.
    for bounce in bounces:
        signals.feedback.send(
            sender=Bounce,
            instance=bounce,
            message=message,
            notification=notification
        )

    logger.info('Logged %s Bounce(s)', str(len(bounces)))

    return HttpResponse('Bounce Processed')
211829
def fetch_sender_txs(self):
        
        
        # fetch remaining sender transactions
        if len(self.sender_info.keys()) > 0:

            sender_txids = self.sender_info.keys()[:]
            sender_txid_batches = []
            batch_size = 20

            for i in xrange(0, len(sender_txids), batch_size ):
                sender_txid_batches.append( sender_txids[i:i+batch_size] )

            for i in xrange(0, len(sender_txid_batches)):

                sender_txid_batch = sender_txid_batches[i]
                log.debug("Fetch %s TXs via JSON-RPC (%s-%s of %s)" % (len(sender_txid_batch), i * batch_size, i * batch_size + len(sender_txid_batch), len(sender_txids)))

                sender_txs = None

                for j in xrange(0, 5):
                    sender_txs = self.fetch_txs_rpc( self.bitcoind_opts, sender_txid_batch )
                    if sender_txs is None:
                        log.error("Failed to fetch transactions; trying again (%s of %s)" % (j+1, 5))
                        time.sleep(j+1)
                        continue

                    break

                if sender_txs is None:
                    raise Exception("Failed to fetch transactions")
                
                # pair back up with nulldata transactions
                for sender_txid, sender_tx in sender_txs.items():

                    assert sender_txid in self.sender_info.keys(), "Unsolicited sender tx %s" % sender_txid

                    # match sender outputs to the nulldata tx's inputs
                    for nulldata_input_vout_index in self.sender_info[sender_txid].keys():
                        if sender_txid != "0000000000000000000000000000000000000000000000000000000000000000":
                            
                            # regular tx, not coinbase 
                            assert nulldata_input_vout_index < len(sender_tx['outs']), 'Output index {} is out of bounds for {}'.format(nulldata_input_vout_index, sender_txid)

                            # save sender info 
                            self.add_sender_info(sender_txid, nulldata_input_vout_index, sender_tx['outs'][nulldata_input_vout_index])
                        
                        else:

                            # coinbase
                            self.add_sender_info(sender_txid, nulldata_input_vout_index, sender_tx['outs'][0])

                    # update accounting
                    self.num_txs_received += 1

        return True
1190412
def from_EmailMessage(cls, message):
        
        mail = cls(
            from_email=Email(message.get('From')),
            subject=message.get('Subject'),
            to_emails=Email(message.get('To')),
        )
        try:
            body = message.get_content()
        except AttributeError:
            # Python2
            body = message.get_payload()
        mail.add_content(Content(
            message.get_content_type(),
            body.strip()
        ))
        for k, v in message.items():
            mail.add_header(Header(k, v))
        return mail
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)
174229
def _DeserializeResponse(self, payload):
        
        # Strip off the status line.
        status_line, payload = payload.split('\n', 1)
        _, status, _ = status_line.split(' ', 2)

        # Parse the rest of the response.
        parser = email_parser.Parser()
        msg = parser.parsestr(payload)

        # Get the headers.
        info = dict(msg)
        info['status'] = status

        # Create Response from the parsed headers.
        content = msg.get_payload()

        return http_wrapper.Response(info, content, self.__batch_url)
684630
def require_sender(f):
    
    @wraps(f)
    def decorator(*args, **kwargs):
        if not request.authorization:
            return jsonify({'message': 'unauthorized'}), 401

        username = request.authorization.username
        password = request.authorization.password

        if not validate_sender(username, password):
            return jsonify({'message': 'forbidden'}), 403

        return f(*args, **kwargs)
    return decorator
1369747
def api_send_mail(request, key=None, hproPk=None):
    """"""

    if not check_api_key(request, key, hproPk):
        return HttpResponseForbidden

    sender = request.POST.get('sender', settings.MAIL_SENDER)
    dests = request.POST.getlist('dests')
    subject = request.POST['subject']
    message = request.POST['message']
    html_message = request.POST.get('html_message')

    if html_message and html_message.lower() == 'false':
        html_message = False

    if 'response_id' in request.POST:
        key = hproPk + ':' + request.POST['response_id']
    else:
        key = None

    generic_send_mail(sender, dests, subject, message, key, 'PlugIt API (%s)' % (hproPk or 'StandAlone',), html_message)

    return HttpResponse(json.dumps({}), content_type="application/json")
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
3494
def receive(
            self,
            request: RequestType,
            user: UserType = None,
            sender_key_fetcher: Callable[[str], str] = None,
            skip_author_verification: bool = False) -> Tuple[str, dict]:
        
        self.user = user
        self.get_contact_key = sender_key_fetcher
        self.payload = json.loads(decode_if_bytes(request.body))
        self.request = request
        self.extract_actor()
        # Verify the message is from who it claims to be
        if not skip_author_verification:
            self.verify_signature()
        return self.actor, self.payload
36773
def Handle_Receive(self, msg):
        

        msg = self.Check_Message(msg)
        msg_type = msg['type']

        f_name = "Handle_{0}".format(msg_type)
        try:
            f = getattr(self, f_name)
        except AttributeError:
            f = self.Handle_ERROR(msg)
        reply = f(msg)

        return reply
1330308
def get_smtp_mail(self):
        
        header = self.get_smtp_header()
        body = self.get_body().replace('\n', '\r\n')
        return header + '\r\n' + body + '\r\n'
917005
def ack(self, msg):
        
        self.log.info("senderID:%s Received: %s " % (self.senderID, msg['body']))
        return stomper.NO_REPONSE_NEEDED