On Sat, 2008-04-19 at 00:43 -0700, Julien wrote: > Thanks for the hints. > > I'm maintaining the code done by another developer:
[... snipped ...] > > As you see, after your comments I added the force_unicode function > call, but it didn't fix the problem. I tried to look into Django code > but I got a bit lost. Can you easily spot the issue in the code above. Unfortunately, robustly sending email is a fairly tricky process and the only effective way I've found to debug it is by carefully reading the error messages and reading through tracebacks to work out where unexpected data comes from. You are in the best position to see which piece of input data is raising the problem and where that problem is coming from. Your code looks roughly correct, but comparing it to Django's version you seem to have just forced everything to Unicode, without noticing that when we create the mail headers, we carefully encode things to UTF-8. Since your method is very similar to the existing Django code, I'd really be tempted to rewrite it in that format. Create an EmailMessage for each message, call attach() on that to add the HTML version (passing in the MIME type) and then call send_messages on an SMTPConnection() should work. It will be slightly more efficient that your version, too (only making one network connection for all the messages). If you don't want to go that path, just proceed slowly, reading the tracebacks and tracing where the data comes from. It can be slightly fiddly, but you'll get there eventually. Malcolm -- If at first you don't succeed, destroy all evidence that you tried. http://www.pointy-stick.com/blog/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@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-users?hl=en -~----------~----~----~----~------~----~------~--~---