djangosnippets.org: Latest snippets tagged with 'email'https://djangosnippets.org/tags/email/2016-01-04T08:42:03.576173-06:00Email authentication backend
2016-01-04T08:42:03.576173-06:00benjaominghttps://djangosnippets.org/snippets/10547/<p>Fixed minimal version, works with Django 1.7+, tested on Django 1.9.</p>
<p>Add the following to your settings:</p>
<pre><code>AUTHENTICATION_BACKENDS = [
'project.backends.UserModelEmailBackend', # Login w/ email
'django.contrib.auth.backends.ModelBackend', # Login w/ username
]
</code></pre>
Freely redistributableTemplate Tag to protect the E-mail address
2015-05-04T18:16:01.755350-05:00end0https://djangosnippets.org/snippets/10482/<p>Update to https://djangosnippets.org/snippets/1907/ to be a bit more flexible, and code cleaned up a tiny bit.</p>
<p>To use, add this snippet as a file in a templatetags folder in an app or in a project. Then include and call the tag with </p>
<p>{% obfuscate_email 'email' %}
or
{% obfuscate_email 'email' …</p>
Freely redistributableCustom Auth Backend to use E-Mail in Django
2015-03-30T11:22:49.818251-05:00bsoculdhttps://djangosnippets.org/snippets/10476/<p>Instead of the default Django User the Auth Model is 'customer' from the usercp App.</p>
<p>User's can use username as a display to the public, without disclosing their login information. This way they can use a forum with their username, which is seen by everyone.
The login credentials, however are …</p>
Freely redistributableTesting email sending
2015-02-19T05:07:37.125086-06:00monikasulikhttps://djangosnippets.org/snippets/10466/<p>How I assert email is being sent correctly</p>
Freely redistributableOne line SMTP sink server
2014-07-25T19:19:20.221144-05:00Baguagehttps://djangosnippets.org/snippets/3085/<p>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.</p>
Freely redistributableMultiple emails field
2014-05-06T09:14:36.037016-05:00cuchachttps://djangosnippets.org/snippets/3047/<p>Model Field allowing to store multiple emails in one textual field. Emails separated by comma. All emails are validated. Works with Django admin.</p>
Freely redistributableEmail Auth
2014-04-26T13:34:40.569149-05:00petzahhttps://djangosnippets.org/snippets/3043/<p>Yet another authentication by email address. This one is quick and dirty as we are saving email address in both Username and Email fields. For proper way how to deal with it see</p>
<p>https://docs.djangoproject.com/en/1.6/topics/auth/customizing/#auth-custom-user</p>
Freely redistributableDisplay values from a bound (submitted) form
2014-03-13T05:20:42.339965-05:00masidahttps://djangosnippets.org/snippets/3036/<p>Function that takes a bound form (submitted form) and returns a list of pairs of field label and user chosen value.</p>
<p>It takes care of:</p>
<ol>
<li>fields that are not filled out</li>
<li>if you want to exclude some fields from the final list</li>
<li>ChoiceField (select or radio button)</li>
<li>MultipleChoiceField (multi-select or …</li></ol>
Freely redistributableMultiple emails form field
2013-12-17T14:48:42.881052-06:00matrixhttps://djangosnippets.org/snippets/3012/<p>Validate form field that include email or emails separated by 'token' kwargs, by default ',' a comma. Return a list [] of email(s). Check validity of the email(s) from django EmailField regex (tested with 1.3, but normally will also work with 1.5)</p>
Freely redistributableDecorator to execute a method only once
2013-12-11T15:47:24.581181-06:00atodorov-otbhttps://djangosnippets.org/snippets/3010/<p>Beware if using Amazon Simple Queue Service to execute Celery tasks which send email messages! Sometimes SQS messages are duplicated which results in multiple copies of the messages being sent. This is a simple decorator which uses a cache backend to prevent the task from executing twice in a specified …</p>
Freely redistributableSending html emails with inline attachments/images using Django
2013-11-07T22:33:53.974651-06:00alexhayeshttps://djangosnippets.org/snippets/3001/<p>I had issues getting <a href="https://djangosnippets.org/snippets/285/">snippet 285</a> working when using a MIMEBase subclass (ie.. MIMEImage).</p>
<p>This modification to <a href="https://djangosnippets.org/snippets/285/">snippet 285</a>.</p>
Freely redistributableEmail backend to BCC all emails
2013-10-21T11:23:55.630621-05:00maikhoepfelhttps://djangosnippets.org/snippets/2997/<p>The backend lets you quickly get an idea of all emails that are sent out. Helpful for debugging or keeping an archive of all communications. Use instead of Django's SMTPBackend.</p>
Freely redistributableEmail-obfuscator Template Tag
2012-05-16T12:00:05.844220-05:00gronimohttps://djangosnippets.org/snippets/2751/<p>This template tag makes email-harvester's business more difficult.</p>
Freely redistributableGet email and push on couchdb - utils
2012-03-01T16:42:59.738310-06:00magik_cypresshttps://djangosnippets.org/snippets/2702/<p>Check email and save</p>
Freely redistributableGet email and push on couchdb - Model
2012-03-01T16:38:53.292657-06:00magik_cypresshttps://djangosnippets.org/snippets/2701/<p>view/admin.py</p>
<p>`
def reactor(request):</p>
<pre><code>context = {
'email': read_mailbox()
}
return render_to_response(_lookup_template('dashboard'), context,
context_instance=RequestContext(request))
</code></pre>
<p>`</p>
<p><strong>_Design all.js</strong></p>
<p><code>function (doc)
{
if (doc.doc_type == 'MailArchive')
{
emit(doc._id, doc);
}
}</code></p>
<p><strong>reduce.js</strong></p>
<p><code>_count</code></p>
Freely redistributable