Comments (15)
We could perhaps introduce a kwarg "split_recipients" (other naming suggestions welcome) to "mail.send".
from django-post_office.
it's quite annoying that it sends multiple emails rather than one to the recipient_list as expected. Adding an optional argument should be ok, but definitely the default behavior should be sending just one email. This is important as it also doesn't support adding people in +cc.
from django-post_office.
I'm open to adding this feature. Any ideas on how to implement this?
Sent from my phone
On Jan 29, 2014, at 7:01 PM, ivans083 [email protected] wrote:
it's quite annoying that it sends multiple emails rather than one to the recipient_list as expected. Adding an optional argument should be ok, but definitely the default behavior should be sending just one email. This is important as it also doesn't support adding people in +cc.
—
Reply to this email directly or view it on GitHub.
from django-post_office.
In mail.py:
emails = [create(sender, recipient, subject, message, html_message, context,
scheduled_time, headers, priority, commit)
for recipient in recipients]
create should take the list of recipients rather than iterating recipients
from django-post_office.
Can this be implemented via user groups as well as individual users? Ideally when mails are sent the "to" field would not disclose other recipients.
Maybe the Email model could be related as M2M to users and groups.
from django-post_office.
I've been thinking about this in the past few days. We should also add cc
, bcc
fields that allows multiple email addresses.
So this would look like:
mail.send(
to=[user_1],
cc=[user_2],
bcc=[user3],
# Other arguments
)
I'll have to find the time to implement this though. I have other features I want to prioritize over this so pull requests are welcome :)
from django-post_office.
Hi,
I hacked this in since I need it. Below are the changes to mail.py and models.py (no DB changes needed with this approach):
In mail.py send():
emails = [create(sender, ",".join(recipients), subject, message, html_message,
context, scheduled_time, headers, template, priority,
render_on_delivery, commit=commit)]
# emails = [create(sender, recipient, subject, message, html_message,
# context, scheduled_time, headers, template, priority,
# render_on_delivery, commit=commit)
# for recipient in recipients]
In models.py Email:
to = models.CharField(max_length=254)
#to = models.EmailField(max_length=254)
In models.py Email->email_message():
msg = EmailMessage(subject, message, self.from_email,
self.to.split(","), connection=connection,
headers=self.headers)
# msg = EmailMessage(subject, message, self.from_email,
# [self.to], connection=connection,
# headers=self.headers)
from django-post_office.
Hello,
Sorry if this is not in line with your thoughts, but I thought it might be
good to still have one receiver per message and at the same time
be able to message multiple users - either by list of emails,
list of AuthUser objects or members of a specific group.
Also - after trying the app I've found that there is a record in the
database per email sent. This in nice, but not practical when you
send thousands of emails. One per campaign might be nicer to have,
or perhaps have a separate entry for "Campaigns"
Thanks for working on this app.
On Tue, May 6, 2014 at 6:40 PM, Dylan Nelson [email protected]:
Hi,
I hacked this in since I need it. Below are the changes to mail.py and
models.py (no DB changes needed with this approach):In mail.py send():
emails = [create(sender, ",".join(recipients), subject, message, html_message, context, scheduled_time, headers, template, priority, render_on_delivery, commit=commit)]
emails = [create(sender, recipient, subject, message, html_message,
context, scheduled_time, headers, template, priority,
render_on_delivery, commit=commit)
for recipient in recipients]
In models.py Email:
to = models.CharField(max_length=254) #to = models.EmailField(max_length=254)
In models.py Email->email_message():
msg = EmailMessage(subject, message, self.from_email, self.to.split(","), connection=connection, headers=self.headers)
msg = EmailMessage(subject, message, self.from_email,
[self.to], connection=connection,
headers=self.headers)
—
Reply to this email directly or view it on GitHubhttps://github.com//issues/28#issuecomment-42362949
.
Askbot
Valparaiso, Chile
skype: evgeny-fadeev
from django-post_office.
@evgenyfadeev you should check one the render_on_delivery
option introduced in 0.8.0 and log_level
later in the series. It allows you to store content only once in EmailTemplate
, I built that with newsletter/campaign type usage in mind.
Content is only stored once in template, yet you still get the benefit of using context variables. All that plus the parallel processing and more flexible logging options allow us to efficiently send millions on email :).
You can do:
for user in User.objects.all():
mail.send(user.email, template=template,
render_on_delivery=True, context={'name': user.username},
log_level=1)
from django-post_office.
@selwin I want to implement cc
and bcc
fields and send one email to multiple recipients. Do you think it would be better to add cc
and bcc
fields to the Email model and store the list of recipients as a comma separated string or add distinct models (like ToRecipient
, CcRecipient
and BccRecipient
) and store each recipient address as a separate entry using a ForeignKey
to the Email
?
I will make a pull request when I'm done.
from django-post_office.
@stefan-mihaila please implement cc
and bcc
fields as comma separated email addresses. Thanks for working on this :)
from django-post_office.
FYI, Django has a CommaSeparatedIntegerField implemented in core so if you could just make something similar for email addresses it would be great
from django-post_office.
Thanks to you for contributing! I'll work on it this weekend.
from django-post_office.
I created a pull request for this issue.
from django-post_office.
Fixed in #63
from django-post_office.
Related Issues (20)
- When using celery emails are not sent directly HOT 6
- MEDIA_ROOT not documented
- Post-office raise 2 same error when there are SMTP connection error HOT 1
- dictionary update sequence element #0 has length 1; 2 is required
- Authorisation fails for Office 365 with new default policies in place HOT 4
- Commit aa1617e creates issues when creating a new email where context is also set. HOT 2
- Mocking email template for tests
- Bleach is deprecated as of 2023-01-23 HOT 1
- Can Templates include sub-Templates? For example, consistent signature/unsubscribe footers HOT 1
- Suggestion: Minimal support for implementing retention policies HOT 1
- Spanish translations
- Create New Email From Django Admin HOT 3
- insanely hard to edit default content for a template HOT 3
- MySQLdb.NotSupportedError
- Is this a correct field rendering in email template?
- Multiple instances on the same server HOT 4
- MAX_RETRIES and RETRY_INTERVAL issue HOT 1
- Email Is not being sent
- Send email with inline images asynchronously
- Attach in template
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-post_office.