LPgenerator / django-db-mailer

Django module to easily send emails/sms/tts/push using django templates stored on database and managed through the Django Admin
https://github.com/LPgenerator/django-db-mailer
GNU General Public License v2.0
255 stars 81 forks source link

Template's subject line length #44

Open vosi opened 8 years ago

vosi commented 8 years ago

RFC doesn't really restrict the subject length and there is an issue while trying to use long Django template for subject with multiple if else

django.db.utils.DataError: value too long for type character varying(100)

I suggest using Text field

gotlium commented 8 years ago

I think we can use CharField with 350 length. But I think this is a big subject. And I do not see migrations for South. We are supporting Django from 1.4.

RFC 2822, section 2.1.1 to start. http://www.faqs.org/rfcs/rfc2822.html

There are two limits that this standard places on the number of characters in a line. Each line of characters MUST be no more than 998 characters, and SHOULD be no more than 78 characters, excluding the CRLF.

The recommendation for no more than 78 characters in the subject header sounds reasonable. No one wants to scroll to see the entire subject line, and something important might get cut off on the right.

vosi commented 8 years ago

I have a Django template in subject, with lots of if else while the template length is abt 1000 chars - compiled length is no larger than 100

if you will limit it to 350 - then what is the point of having subject treated as the template? All idea of this was to allow site's administrator to edit every bit of email template without getting deep to the code

as for RFC subj length - subj can be multiple lines and there is no limit on resulting length and you won't find mail server's default config that will limit the subject's length

gotlium commented 8 years ago

Ok. Please fix the problem with compatibility with old Django versions. PS - can you show me real use cases for subjects with length > 100 ?)

vosi commented 8 years ago

will do today... in the evening merry Christmas btw

gotlium commented 8 years ago

Thx, you too) And with New Year)

vosi commented 8 years ago

well I have a set of Start text {{ obj.param1 }}, {% if obj.param2 %} ..... {% elif ....... {%if obj2.param1 .... etc

the result is much shorter, like New job posted, Title, region or suburb or locality or remote, keywords or expire date ...

and for a/b testing and just for the ease of management it is much easier to have this editable in the admin panel, than via the source code

gotlium commented 8 years ago

Yes, you are right)

kaleb commented 6 years ago

@vosi one thing I have done to get around this, even though it is not ideal since it is no longer editable in the database is that I have added {% include ... %} statements in the subject