a small typo in #3007/r4058

2006-11-10 Thread Igor Goryachev

Hello people.

There is a small bug/typo in patch came with r4058 revision.

random_bits variable became string instead of integer, so the following:

-msg['Message-ID'] = "<[EMAIL PROTECTED]>" % (time.time(), random_bits, 
DNS_NAME)

should be changed to:

+msg['Message-ID'] = "<[EMAIL PROTECTED]>" % (time.time(), random_bits, 
DNS_NAME)


BTW, I've tried to reopen #3007, but got the following message:

Submission rejected as potential spam (Akismet says content is spam)


-- 
Igor Goryachev  E-Mail/Jabber: [EMAIL PROTECTED]

--~--~-~--~~~---~--~~
 You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~--~~~~--~~--~--~---



Re: sending mail in utf-8

2006-01-16 Thread Igor Goryachev

Igor Goryachev <[EMAIL PROTECTED]> writes:

> I think it would be very useful if it was possible to send e-mail (using
> 'django.core.mail') in something different than 'us-ascii', for example,
> in 'utf-8' by default. I have tried to implement this:

I have reworked it a bit and submitted patch Ticket #1235.

Any feedback?


-- 
    Igor Goryachev  E-Mail/Jabber: [EMAIL PROTECTED]


sending mail in utf-8

2006-01-15 Thread Igor Goryachev


Hello.

I think it would be very useful if it was possible to send e-mail (using
'django.core.mail') in something different than 'us-ascii', for example,
in 'utf-8' by default. I have tried to implement this:

=
Index: django/conf/global_settings.py
===
--- django/conf/global_settings.py  (revision 1983)
+++ django/conf/global_settings.py  (working copy)
@@ -68,6 +68,9 @@
 DEFAULT_CONTENT_TYPE = 'text/html'
 DEFAULT_CHARSET = 'utf-8'
 
+# Default charset used for sending e-mail messages.
+DEFAULT_EMAIL_CHARSET = 'utf-8'
+
 # E-mail address that error messages come from.
 SERVER_EMAIL = '[EMAIL PROTECTED]'
 
Index: django/core/mail.py
===
--- django/core/mail.py (revision 1983)
+++ django/core/mail.py (working copy)
@@ -1,7 +1,9 @@
 # Use this module for e-mailing.
 
 from django.conf.settings import DEFAULT_FROM_EMAIL, EMAIL_HOST, 
EMAIL_SUBJECT_PREFIX
+from django.conf.settings import DEFAULT_EMAIL_CHARSET
 from email.MIMEText import MIMEText
+from email.Header import Header
 import smtplib
 
 class BadHeaderError(ValueError):
@@ -39,8 +41,8 @@
 if not recipient_list:
 continue
 from_email = from_email or DEFAULT_FROM_EMAIL
-msg = SafeMIMEText(message)
-msg['Subject'] = subject
+msg = SafeMIMEText(message, 'plain', DEFAULT_EMAIL_CHARSET)
+msg['Subject'] = str(Header(subject, 
DEFAULT_EMAIL_CHARSET)).replace('\n', '').replace('\r', '')
 msg['From'] = from_email
 msg['To'] = ', '.join(recipient_list)
 server.sendmail(from_email, recipient_list, msg.as_string())

=


-- 
Igor Goryachev  E-Mail/Jabber: [EMAIL PROTECTED]