Re: [web2py] Re: How could I send a email to every members?

2010-11-25 Thread Branko Vukelic
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


Re: [web2py] Re: How could I send a email to every members?

2010-11-24 Thread Thadeus Burgess
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.