How to use mailchecker - 9 common examples

To help you get started, we’ve selected a few mailchecker examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github gbozee / django-rest-admin / mailchecker / options.py View on Github external
def _bind(self):
        super(MessageOptions, self)._bind()

        from .models import Thread, Message
        self.thread = ForeignKey(Thread)
        self.thread.contribute_to_class(Thread, 'thread')
        self.concrete_model = Message
        self._gmail_other_fields['thread'] = self.thread
github gbozee / django-rest-admin / mailchecker / options.py View on Github external
def _bind(self):
        super(MessageOptions, self)._bind()

        from .models import Thread, Message
        self.thread = ForeignKey(Thread)
        self.thread.contribute_to_class(Thread, 'thread')
        self.concrete_model = Message
        self._gmail_other_fields['thread'] = self.thread
github gbozee / django-rest-admin / mailchecker / models.py View on Github external
def thread(self):
        # return Thread.objects.get(id=self.thread_id)
        return Thread.objects.get(id=self.id)
github gbozee / django-rest-admin / mailchecker / models.py View on Github external
from django.db.models import ForeignKey
from mservice_model.models import ServiceModel
from .manager import ThreadManager, MessageManager
from . import mailer
from django.db.models.fields import (AutoField, CharField, TextField)
from mservice_model.options import ServiceOptions


class GmailAutoField(AutoField):
    def to_python(self, value):
        return value


class Thread(ServiceModel):
    _default_manager = ThreadManager
    _service_api = mailer.GmailApi("h")

    # _meta = ThreadOptions()
    class Meta(ServiceOptions):
        _service_fields = {
            'id': GmailAutoField(),
            'to': CharField(max_length=200),
            'number_of_messages': CharField(max_length=200),
        }

    def __init__(self, id=None, to=None, number_of_messages=None):
        self.id = id
        self.to = to
        self.number_of_messages = number_of_messages

    @property
    def messages(self):
github gbozee / django-rest-admin / mailchecker / models.py View on Github external
def messages(self):
        return Message.objects.filter(thread=self.id)
github gbozee / django-rest-admin / mailchecker / options.py View on Github external
def _bind(self):
        super(MessageOptions, self)._bind()

        from .models import Thread, Message
        self.thread = ForeignKey(Thread)
        self.thread.contribute_to_class(Thread, 'thread')
        self.concrete_model = Message
        self._gmail_other_fields['thread'] = self.thread
github gbozee / django-rest-admin / mailchecker / options.py View on Github external
model_name = 'thread'
    verbose_name = 'thread'
    verbose_name_raw = 'thread'
    verbose_name_plural = 'threads'
    object_name = 'thread'
    default_related_name = None

    _gmail_pk_field = 'id'
    _gmail_fields = {
        'id': GmailAutoField(),
        'to': CharField(max_length=200),
        'number_of_messages': CharField(max_length=200),
    }


class MessageOptions(GmailOptions):
    app_label = 'mailchecker'
    model_name = 'message'
    verbose_name = 'message'
    verbose_name_raw = 'message'
    verbose_name_plural = 'messages'
    object_name = 'message'
    default_related_name = None

    _gmail_pk_field = 'id'
    _gmail_fields = {
        'id': GmailAutoField(),
        'receiver': CharField(max_length=200),
        'sender': CharField(max_length=200),
        'snippet': CharField(max_length=200),
        'body': TextField(),
    }
github gbozee / django-rest-admin / mailchecker / options.py View on Github external
field for field_name, field in
            sorted(list(self._gmail_fields.items()) +
                   list(self._gmail_other_fields.items()))
        )

    def get_field(self, field_name):
        try:
            return self._gmail_fields[field_name]
        except KeyError:
            try:
                return self._gmail_other_fields[field_name]
            except KeyError:
                raise FieldDoesNotExist()


class ThreadOptions(GmailOptions):
    auto_created = False
    app_label = 'mailchecker'
    model_name = 'thread'
    verbose_name = 'thread'
    verbose_name_raw = 'thread'
    verbose_name_plural = 'threads'
    object_name = 'thread'
    default_related_name = None

    _gmail_pk_field = 'id'
    _gmail_fields = {
        'id': GmailAutoField(),
        'to': CharField(max_length=200),
        'number_of_messages': CharField(max_length=200),
    }
github gbozee / django-rest-admin / mailchecker / options.py View on Github external
def _bind(self):
        super(MessageOptions, self)._bind()

        from .models import Thread, Message
        self.thread = ForeignKey(Thread)
        self.thread.contribute_to_class(Thread, 'thread')
        self.concrete_model = Message
        self._gmail_other_fields['thread'] = self.thread

mailchecker

Cross-language email validation. Backed by a database of thousands throwable email providers.

MIT
Latest version published 2 months ago

Package Health Score

87 / 100
Full package analysis

Similar packages