This repository has been archived by the owner on Sep 17, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #55 from nielsonsantana/master
Added feature of set reply-to on the message
- Loading branch information
Showing
5 changed files
with
88 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# -*- coding: utf-8 -*- | ||
from __future__ import unicode_literals | ||
|
||
from django.db import models, migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('mailqueue', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='mailermessage', | ||
name='reply_to', | ||
field=models.TextField(max_length=250, null=True, verbose_name='Reply to', blank=True), | ||
preserve_default=True, | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
mailqueue/south_migrations/0007_auto__add_field_mailermessage_reply_to.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# -*- coding: utf-8 -*- | ||
from south.utils import datetime_utils as datetime | ||
from south.db import db | ||
from south.v2 import SchemaMigration | ||
from django.db import models | ||
|
||
|
||
class Migration(SchemaMigration): | ||
|
||
def forwards(self, orm): | ||
# Adding field 'MailerMessage.reply_to' | ||
db.add_column(u'mailqueue_mailermessage', 'reply_to', | ||
self.gf('django.db.models.fields.TextField')(max_length=250, null=True, blank=True), | ||
keep_default=False) | ||
|
||
|
||
def backwards(self, orm): | ||
# Deleting field 'MailerMessage.reply_to' | ||
db.delete_column(u'mailqueue_mailermessage', 'reply_to') | ||
|
||
|
||
models = { | ||
u'mailqueue.attachment': { | ||
'Meta': {'object_name': 'Attachment'}, | ||
'email': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['mailqueue.MailerMessage']", 'null': 'True', 'blank': 'True'}), | ||
'file_attachment': ('django.db.models.fields.files.FileField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), | ||
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}) | ||
}, | ||
u'mailqueue.mailermessage': { | ||
'Meta': {'object_name': 'MailerMessage'}, | ||
'app': ('django.db.models.fields.CharField', [], {'max_length': '250', 'blank': 'True'}), | ||
'bcc_address': ('django.db.models.fields.TextField', [], {'blank': 'True'}), | ||
'content': ('django.db.models.fields.TextField', [], {'blank': 'True'}), | ||
'from_address': ('django.db.models.fields.EmailField', [], {'max_length': '250'}), | ||
'html_content': ('django.db.models.fields.TextField', [], {'blank': 'True'}), | ||
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), | ||
'last_attempt': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}), | ||
'reply_to': ('django.db.models.fields.TextField', [], {'max_length': '250', 'null': 'True', 'blank': 'True'}), | ||
'sent': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), | ||
'subject': ('django.db.models.fields.CharField', [], {'max_length': '250', 'blank': 'True'}), | ||
'to_address': ('django.db.models.fields.TextField', [], {}) | ||
} | ||
} | ||
|
||
complete_apps = ['mailqueue'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from django.test import TestCase | ||
from mailqueue.models import MailerMessage | ||
from .utils import create_email | ||
|
||
|
||
class MailerMessageTestCase(TestCase): | ||
|
||
def test_send_mail_reply_to(self): | ||
"""Testing creating a MailerMessage and send mail""" | ||
reply_to = "[email protected]" | ||
mail = create_email(reply_to=reply_to) | ||
mail.send_mail() | ||
|
||
self.assertEqual(mail.sent, True) | ||
self.assertEqual(mail.reply_to, reply_to) |