Re: Not able to send email to more than 2 email address
Dear Russell Keith-Magee
Now its working!
Thanks
On Thursday, June 13, 2013 5:00:30 AM UTC+5:30, Russell Keith-Magee wrote:
--On Thu, Jun 13, 2013 at 3:28 AM, <roopas...@gmail.com> wrote:models.pyclass FollowerEmail(models.Model): report = models.ForeignKey(Report) email = models.CharField('Email', max_length=100)
views.py
def what(request):
""""""
follower = FollowerEmail.objects.filter(report=report)
list=[]
for email in follower:
list.append(email.email)
""""""""
if 'send_email' in request.POST:
subject, from_email, to = 'Notification',user.email, person.parent_email
html_content = render_to_string('incident/print.html',{'person':person,
'report':report,
'list':list,
})
text_content = strip_tags(html_content)
msg = EmailMultiAlternatives(subject, text_content, from_email, [to],bcc=[list], cc=['roopas...@gmail.com'] )
msg.attach_alternative(html_content, "text/html")
msg.send()
The above is my view.py to send email,email is sending to "to" address properlly.Problem is with bcc tag.I am taking the email from FollowerEmail table and making a list.I am passing that list to bcc,as bcc email id list would be large,will be more than 3.
If list is having more than 2 email id,application is not sending mail,if it is two or one,application is sending mail.What could be the problemIt looks to me like the problem lies with the argument you're passing to bcc. The value you're passing to bcc isn't a list of email addresses -- it's a list that contains a list of email addresses. Honestly, I'm surprised it's working even for the 1 and 2 email case. Make the argument to EmailMultiAlternatives bcc=list, and it should work.Yours,Russ Magee %-)
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home