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.

Reply via email to