mirror of
https://github.com/postgres/pgweb.git
synced 2025-08-03 15:38:59 +00:00

Sent email can be assigned a "stagger type", for which he system will maintain a "last sent" information. When the email is sent, it will be delayed to be at least "stagger" time after the last one sent of the same type. If no email of this type has been sent before, the email is of course sent immediately.
22 lines
923 B
Python
22 lines
923 B
Python
from django.db import models
|
|
|
|
|
|
class QueuedMail(models.Model):
|
|
sender = models.EmailField(max_length=100, null=False, blank=False)
|
|
receiver = models.EmailField(max_length=100, null=False, blank=False)
|
|
# We store the raw MIME message, so if there are any attachments or
|
|
# anything, we just push them right in there!
|
|
fullmsg = models.TextField(null=False, blank=False)
|
|
# Flag if the message is "user generated", so we can treat those
|
|
# separately from an antispam and delivery perspective.
|
|
usergenerated = models.BooleanField(null=False, blank=False, default=False)
|
|
sendat = models.DateTimeField(null=False, blank=False)
|
|
|
|
def __str__(self):
|
|
return "%s: %s -> %s" % (self.pk, self.sender, self.receiver)
|
|
|
|
|
|
class LastSent(models.Model):
|
|
type = models.CharField(max_length=10, null=False, blank=False, unique=True)
|
|
lastsent = models.DateTimeField(null=False, blank=False)
|