[web2py] Re: How could I send a email to every members?
why not send one mail with everybody in bcc? On Nov 24, 3:50 pm, Thadeus Burgess thade...@thadeusb.com wrote: the problem with mail.send is it creates a brand new connection to the SMTP server *every* single time you call it. If you are sending more than 10 emails at a time this will not be efficient and will take an unnecessary amount of time to complete. I would suggest dropping down to using base smtplib so you can send everything through a single connection. Keep in mind when doing this certain SMTP servers have limits on how many emails can be sent (500 by default) so you would need to re-establish your connection after this cutoff point. -- Thadeus On Wed, Nov 24, 2010 at 1:09 AM, annet annet.verm...@gmail.com wrote: Hi David, I have a crm app from which I send html mails using the following function: def mail(): m_list=db(...).select(...) for item in m_list: context=dict(item=item) message=response.render('mail/mail.html',context) recipient=item.email boolean=mail.send(to=[recipient],subject='...',message=[None,message]) if boolean: db.mailingstats.insert(...) else: db.adminstats.insert(...) return True The boolean stuff isn't a necessity but it gives me feedback on the process, and I use the mailingstats table for statistical purposes. If you're sending html mails make sure the layout is all tables, and put the css in the body not in the head. If you need an example I'll post a view. Kind regards, Annet.
[web2py] Re: How could I send a email to every members?
On Nov 25, 9:40 am, selecta gr...@delarue-berlin.de wrote: why not send one mail with everybody in bcc? It depends on your mail provider. In our case, I found out that they do not like more than 50 recipients in one single email. So what I often do is put 45 names at a time in BCC. I also limit it to 500 per hour. Otherwise, our mail providers can get a bit touchy and suspend you for a while. If I need more than 500 per hour, I send via alternating mail servers. We have access to at least 4 servers, so that's up to 2000 per hour. I appreciate that we can send mail directly, but these days mail from unrecognised servers is considered 'suspicious' by the recipients' mail service providers and then has a much higher chance of going in the spam basket. As we do not send spam and do not need high volumes of mail, we try to stay well within the rules. Works for us :) -D
Re: [web2py] Re: How could I send a email to every members?
On Thu, Nov 25, 2010 at 12:41 PM, villas villa...@gmail.com wrote: I appreciate that we can send mail directly, but these days mail from unrecognised servers is considered 'suspicious' by the recipients' There's a big difference between 'unrecognized' and 'unidentified'. The latter is a server that is not properly set up to identify itself to the receiving end (either by mistake, or with intent), and gets marked as spam. The former is fine, as long as it identifies itself correctly. -- Branko Vukelić bg.bra...@gmail.com stu...@brankovukelic.com Check out my blog: http://www.brankovukelic.com/ Check out my portfolio: http://www.flickr.com/photos/foxbunny/ Registered Linux user #438078 (http://counter.li.org/) I hang out on identi.ca: http://identi.ca/foxbunny Gimp Brushmakers Guild http://bit.ly/gbg-group
[web2py] Re: How could I send a email to every members?
Hi Branko, Yes, I'm sure you are probably right and I am not an expert with this. We have just tried it various ways and we got the best results sending via recognisable 'mainstream' mail service providers. We can live within the limits of their quotas, so we just do it that way. If you want to use your own server, I understand these details can be significant: * Not blacklisted * Server has MX and reverse DNS records * Have SPF DNS records * Sender_id * Server's HELO response matches hostname * Server is not an open relay * DNS TTL is not too low The problem is that you don't always know if you're ending up in the junk mail. And, if you do find out, it's not always clear why :) -D On Nov 25, 12:22 pm, Branko Vukelic bg.bra...@gmail.com wrote: On Thu, Nov 25, 2010 at 12:41 PM, villas villa...@gmail.com wrote: I appreciate that we can send mail directly, but these days mail from unrecognised servers is considered 'suspicious' by the recipients' There's a big difference between 'unrecognized' and 'unidentified'. The latter is a server that is not properly set up to identify itself to the receiving end (either by mistake, or with intent), and gets marked as spam. The former is fine, as long as it identifies itself correctly. -- Branko Vukelić bg.bra...@gmail.com stu...@brankovukelic.com Check out my blog:http://www.brankovukelic.com/ Check out my portfolio:http://www.flickr.com/photos/foxbunny/ Registered Linux user #438078 (http://counter.li.org/) I hang out on identi.ca:http://identi.ca/foxbunny Gimp Brushmakers Guildhttp://bit.ly/gbg-group
Re: [web2py] Re: How could I send a email to every members?
the problem with mail.send is it creates a brand new connection to the SMTP server *every* single time you call it. If you are sending more than 10 emails at a time this will not be efficient and will take an unnecessary amount of time to complete. I would suggest dropping down to using base smtplib so you can send everything through a single connection. Keep in mind when doing this certain SMTP servers have limits on how many emails can be sent (500 by default) so you would need to re-establish your connection after this cutoff point. -- Thadeus On Wed, Nov 24, 2010 at 1:09 AM, annet annet.verm...@gmail.com wrote: Hi David, I have a crm app from which I send html mails using the following function: def mail(): m_list=db(...).select(...) for item in m_list: context=dict(item=item) message=response.render('mail/mail.html',context) recipient=item.email boolean=mail.send(to=[recipient],subject='...',message=[None,message]) if boolean: db.mailingstats.insert(...) else: db.adminstats.insert(...) return True The boolean stuff isn't a necessity but it gives me feedback on the process, and I use the mailingstats table for statistical purposes. If you're sending html mails make sure the layout is all tables, and put the css in the body not in the head. If you need an example I'll post a view. Kind regards, Annet.
[web2py] Re: How could I send a email to every members?
I agree + queue emails and have a background process send them. On Nov 24, 8:50 am, Thadeus Burgess thade...@thadeusb.com wrote: the problem with mail.send is it creates a brand new connection to the SMTP server *every* single time you call it. If you are sending more than 10 emails at a time this will not be efficient and will take an unnecessary amount of time to complete. I would suggest dropping down to using base smtplib so you can send everything through a single connection. Keep in mind when doing this certain SMTP servers have limits on how many emails can be sent (500 by default) so you would need to re-establish your connection after this cutoff point. -- Thadeus On Wed, Nov 24, 2010 at 1:09 AM, annet annet.verm...@gmail.com wrote: Hi David, I have a crm app from which I send html mails using the following function: def mail(): m_list=db(...).select(...) for item in m_list: context=dict(item=item) message=response.render('mail/mail.html',context) recipient=item.email boolean=mail.send(to=[recipient],subject='...',message=[None,message]) if boolean: db.mailingstats.insert(...) else: db.adminstats.insert(...) return True The boolean stuff isn't a necessity but it gives me feedback on the process, and I use the mailingstats table for statistical purposes. If you're sending html mails make sure the layout is all tables, and put the css in the body not in the head. If you need an example I'll post a view. Kind regards, Annet.
[web2py] Re: How could I send a email to every members?
I'd like to see that table layout Annet has :) Annet, is that ok ? Thanks, Mart :) On Nov 24, 10:05 am, mdipierro mdipie...@cs.depaul.edu wrote: I agree + queue emails and have a background process send them. On Nov 24, 8:50 am, Thadeus Burgess thade...@thadeusb.com wrote: the problem with mail.send is it creates a brand new connection to the SMTP server *every* single time you call it. If you are sending more than 10 emails at a time this will not be efficient and will take an unnecessary amount of time to complete. I would suggest dropping down to using base smtplib so you can send everything through a single connection. Keep in mind when doing this certain SMTP servers have limits on how many emails can be sent (500 by default) so you would need to re-establish your connection after this cutoff point. -- Thadeus On Wed, Nov 24, 2010 at 1:09 AM, annet annet.verm...@gmail.com wrote: Hi David, I have a crm app from which I send html mails using the following function: def mail(): m_list=db(...).select(...) for item in m_list: context=dict(item=item) message=response.render('mail/mail.html',context) recipient=item.email boolean=mail.send(to=[recipient],subject='...',message=[None,message]) if boolean: db.mailingstats.insert(...) else: db.adminstats.insert(...) return True The boolean stuff isn't a necessity but it gives me feedback on the process, and I use the mailingstats table for statistical purposes. If you're sending html mails make sure the layout is all tables, and put the css in the body not in the head. If you need an example I'll post a view. Kind regards, Annet.
[web2py] Re: How could I send a email to every members?
Here are the layouts I am using: maillayout.html html head meta http-equiv=Content-Type content=text/html; charset=utf-8 / title {{if response.title:}}{{=response.title}}{{else:}} {{=URL(r=request)}}{{pass}} /title /head body style type=text/css media=screen {{include 'css.html'}} /style {{domain='http://www.fitwise.nl'}} table class=bg1 width=100% border=0 cellspacing=0 cellpadding=0 tbody tr td align=center table class=bg2 width=600 border=0 cellspacing=0 cellpadding=0 tbody tr td class=browserversion align=left pHaving trouble viewing this email? {{=A('View it in your browser', _href=domain + URL(r=request,f='browser_version',args=[item.company_id]), _target=_blank)}}/p /td /tr tr td class=header align=left img src=http://www.images.fitwise.nl/ crm_header.jpg alt=Header width=600 height=192 / /td /tr tr td valign=top class=body table width=100% border=0 cellspacing=0 cellpadding=0 tbody tr td class=content valign=top align=left h2Fitwise/h2 {{include}} p class=signaturebr /Kind regards,br / br /Team Fitwise /p /td /tr /tbody /table /td /tr tr td class=footer valign=middle align=left height=61 pNot interested anymore? {{=A('Unsubscribe', _href=domain + URL(r=request,c='default',f='unsubscribe',args=[item.company_id,'logomail']), _target=_blank)}}/p /td /tr /tbody /table /td /tr /tbody /table /body /html mail.html {{extend 'maillayout.html'}} pText .../p pText ... /p etc. css.html body { background-color: #EE; } table.bg1 { background-color: #EE; } table.bg2 { background-color: #FF; } td.browserversion { background-color: #EE; padding: 9px 24px 9px 24px; } td.browserversion p { color: #44; font-family: Arial; font-size: 11px; font-weight: normal; margin: 0; padding: 0; } td.browserversion p a { color: #44; font-family: Arial; font-size: 11px; font-weight: normal; text-decoration: underline; } td.body { background-color: #FF; padding: 24px 24px 24px 24px; } td.content { margin: 0; padding: 0px 24px 0px 24px; } td.content h2 { color: #4169E1; font-family: Arial; font-size: 16px; font-weight: bold; margin: 0; padding: 0; } td.content p, .data td { color: #44; font-family: Arial; font-size: 13px; font-weight: normal; margin: 12px 0 12px 0; padding: 0; } td.content p a, .data td a { color: #4169E1; font-family: Arial; font-size: 13px; font-weight: normal; text-decoration: none; } td.content ul li { color: #44; font-family: Arial; font-size: 13px; font-weight: normal; } td.content p.signature { font-family: Arial; font-size: 13px; font-weight: normal; text-align: right; padding: 0 24px 0 0; } td.footer { background-color: #AA; text-align: center; height: 36px; vertical-align: middle; } td.footer p { color: #FF; font-family: Arial; font-size: 11px; font-weight: normal; margin: 0; padding: 0; } td.footer p a { color: #FF; font-family: Arial; font-size: 11px; font-weight: normal; text-decoration: underline; } You need: {{domain='http://www.fitwise.nl'}} because the recipient of the email doesn't know the hostname. See this post for comments on this solution: http://groups.google.com/group/web2py/browse_thread/thread/917e56e86ee973d/6ad92427381358ac Since, for the time being, this works for me I so far didn't bother to implement a better solution. The browser version of the mail is similar to this one except that it's adjusted to display in a browser. Kind regards, Annet.
[web2py] Re: How could I send a email to every members?
Hi Thadeus, Back in April when I was working on sending an email from within web2py I had a look at this slice: http://www.web2pyslices.com/main/slices/take_slice/69 At the time this was too complicated for me to implement, so I chose the procedure described above. Besides, the sentence 'the code could be improved' also made me decide to lay this aside. Your suggestion is on my to-do list, but, since I don't send more than 750 mails a time, which takes less than a minute, it doesn't have priority. Kind regards, Annet
[web2py] Re: How could I send a email to every members?
thanks for that :) On Nov 24, 1:36 pm, annet annet.verm...@gmail.com wrote: Here are the layouts I am using: maillayout.html html head meta http-equiv=Content-Type content=text/html; charset=utf-8 / title {{if response.title:}}{{=response.title}}{{else:}} {{=URL(r=request)}}{{pass}} /title /head body style type=text/css media=screen {{include 'css.html'}} /style {{domain='http://www.fitwise.nl'}} table class=bg1 width=100% border=0 cellspacing=0 cellpadding=0 tbody tr td align=center table class=bg2 width=600 border=0 cellspacing=0 cellpadding=0 tbody tr td class=browserversion align=left pHaving trouble viewing this email? {{=A('View it in your browser', _href=domain + URL(r=request,f='browser_version',args=[item.company_id]), _target=_blank)}}/p /td /tr tr td class=header align=left img src=http://www.images.fitwise.nl/ crm_header.jpg alt=Header width=600 height=192 / /td /tr tr td valign=top class=body table width=100% border=0 cellspacing=0 cellpadding=0 tbody tr td class=content valign=top align=left h2Fitwise/h2 {{include}} p class=signaturebr /Kind regards,br / br /Team Fitwise /p /td /tr /tbody /table /td /tr tr td class=footer valign=middle align=left height=61 pNot interested anymore? {{=A('Unsubscribe', _href=domain + URL(r=request,c='default',f='unsubscribe',args=[item.company_id,'logomail']), _target=_blank)}}/p /td /tr /tbody /table /td /tr /tbody /table /body /html mail.html {{extend 'maillayout.html'}} pText .../p pText ... /p etc. css.html body { background-color: #EE;} table.bg1 { background-color: #EE;} table.bg2 { background-color: #FF;} td.browserversion { background-color: #EE; padding: 9px 24px 9px 24px;} td.browserversion p { color: #44; font-family: Arial; font-size: 11px; font-weight: normal; margin: 0; padding: 0;} td.browserversion p a { color: #44; font-family: Arial; font-size: 11px; font-weight: normal; text-decoration: underline;} td.body { background-color: #FF; padding: 24px 24px 24px 24px;} td.content { margin: 0; padding: 0px 24px 0px 24px;} td.content h2 { color: #4169E1; font-family: Arial; font-size: 16px; font-weight: bold; margin: 0; padding: 0;} td.content p, .data td { color: #44; font-family: Arial; font-size: 13px; font-weight: normal; margin: 12px 0 12px 0; padding: 0;} td.content p a, .data td a { color: #4169E1; font-family: Arial; font-size: 13px; font-weight: normal; text-decoration: none;} td.content ul li { color: #44; font-family: Arial; font-size: 13px; font-weight: normal;} td.content p.signature { font-family: Arial; font-size: 13px; font-weight: normal; text-align: right; padding: 0 24px 0 0;} td.footer { background-color: #AA; text-align: center; height: 36px; vertical-align: middle;} td.footer p { color: #FF; font-family: Arial; font-size: 11px; font-weight: normal; margin: 0; padding: 0;} td.footer p a { color: #FF; font-family: Arial; font-size: 11px; font-weight: normal; text-decoration: underline; } You need: {{domain='http://www.fitwise.nl'}} because the recipient of the email doesn't know the hostname. See this post for comments on this solution:http://groups.google.com/group/web2py/browse_thread/thread/917e56e86e... Since, for the time being, this works for me I so far didn't bother to implement a better solution. The browser version of the mail is similar to this one except that it's adjusted to display in a browser. Kind regards, Annet.
[web2py] Re: How could I send a email to every members?
Hi David, I have a crm app from which I send html mails using the following function: def mail(): m_list=db(...).select(...) for item in m_list: context=dict(item=item) message=response.render('mail/mail.html',context) recipient=item.email boolean=mail.send(to=[recipient],subject='...',message=[None,message]) if boolean: db.mailingstats.insert(...) else: db.adminstats.insert(...) return True The boolean stuff isn't a necessity but it gives me feedback on the process, and I use the mailingstats table for statistical purposes. If you're sending html mails make sure the layout is all tables, and put the css in the body not in the head. If you need an example I'll post a view. Kind regards, Annet.