Simple class to organize email templates
**Provides pattern to organize and send your email messages.**
- template
- pattern
**Provides pattern to organize and send your email messages.**
Start simple SMTP server on localhost:25 and print to standard output all email headers and the email body. Useful for debugging outgoing mail without configuring SMTP daemon in development enviroment.
Model Field allowing to store multiple emails in one textual field. Emails separated by comma. All emails are validated. Works with Django admin.
Use in a with statement to set the translation to another locale for a block >>> from django.utils.translation import ugettext >>> ugettext('title') u'title' >>> with Translation('fr') as locale: ...: print locale.locale ...: print ugettext('title') ...: ...: fr titre >>> ugettext('title') u'title'
Python includes (and [Django recommends](http://docs.djangoproject.com/en/dev/topics/email/?from=olddocs#testing-e-mail-sending)) a simple email debugging server which prints mail to stdout. The trouble is, unlike any half-competent mail reader, long lines are broken up, and thus long URLs don't work without modification. This snippet simply unwraps long lines (broken by "=") so long URLs can be easily copied/pasted from the terminal. Save this snippet into a file named "better.py" and execute it.
This basically takes the debug you get from setting debug=True, but instead, pipes it into an email and sends it over to you. I have extracted this out of our de framework, it should work, but some modifications may be necessary.
ReportBug() allows you to send exception details to you, via email, but with far more detail than the default. It uses the base function for the traceback used by the Debug mode on Django. This is a first revision, so the emails have no decent styling, but it works, and shows scope on each stack. It will automatically generate a random serial number per error, so you can track them in your favourite bug tracker. It also has support for you to pass it a request variable, so the mail would also contain request/response context. Again, i'm gonna look into doing this manually in the future. Hope this helps! Mwah. Cal Leeming. cal [at] simplicitymedialtd.co.uk. Simplicity Media Ltd.
This is what I use to send simple status emails from my sites. Instead of a django.core.mail.send_mail call, which can take an irrritatingly, nondeterministically long time to return (regardless of error state), you can stow the emails in the database and rely on a separate interpreter process send them off (using a per-minute cron job or what have you). You then also have a record of everything you've sent via email from your code without having to configure your outbound SMTP server to store them or anything like that. Usage notes are in the docstring; share and enjoy.
By using this simple wrapper instead of Django's default send_mail function, you gain the peace of mind of knowing that when settings.DEBUG == True, all the emails will be sent to you instead of the original recipient. Handy for testing.
This middleware makes the admin error emails a lot more informative: you get the same HTML response that you get with `DEBUG=True`. It uses the base class defined in [#638](http://www.djangosnippets.org/snippets/638/). You will probably want to apply the patch for [#6748](http://code.djangoproject.com/ticket/6748) to help avoid slowdowns caused by unintentional database queries. As the ticket (and django-developers thread) notes, it isn't foolproof; you may still find this executing database queries.
Django EmailMessage class has no cc support and has bug in bcc support. Core developers won't add cc support (see ticket http://code.djangoproject.com/ticket/5790), and I don't want to wait half a year until they will realize they have a flaw that bcc recipients are sent to regular "to:" recipients and fix it. So, if you want to use EmailMessage class right now, you'd better use FixedEmailMessage class. Class contract is the same, except for a new cc constructor argument.
You can use this method to send information mails to the related staff members about section specific site activity. All users which explicitly permitted to 'change' given object will be informed about activity. If you defined get_absolute_url in your model then you can simply use it like this; ` obj=form.save() mail2perm(obj) ` Or you can define your custom urls ; ` from util.mail2perm import mail2perm,domain reply=get_object_or_404(Reply,user=request.user,pk=id) mail2perm(reply,url='http://%s/admin/support/show/?id=%s'%(domain,reply.id)) `
I have not extensively test this yet. But working for templates with embedded images. If you want to use Django template system use `msg` and optionally `textmsg` as template context (dict) and define `template` and optionally `texttemplate` variables. Otherwise msg and textmsg variables are used as html and text message sources. If you want to use images in html message, define physical paths and ids in tuples. (image paths are relative to MEDIA_ROOT) example: images=(('email_images/logo.gif','img1'),('email_images/footer.gif','img2')) use them in html like this: `<img src="cid:img1"><br><img src="cid:img2">` stripogram and feedparser modules are used for extract plain text from html message source. If you are going to define text partition explicitly, than you can comment out line 10,11 and 48.
13 snippets posted so far.