I'm trying to get the email module to work. In my model I say:

#model
mail.settings.server='localhost'            # your SMTP server
mail.settings.login=None                    # your credentials
mail.settings.sender='no-re...@foobar.com'  # your email

#controller "admin.py"
def email_blast():
  """Controller for sending email blasts to filtered user lists"""
  # set up crud
  crud.settings.create_onaccept=lambda form: send_email(form)
  crud.settings.update_onaccept=lambda form: None
  # build crud form
  form = crud.update(db.email_blast,request.args(2),message=T('Blast
sent'))
  # build record table
  rows=crud.select(db.email_blast)
  return dict(form=form,rows=rows)

def send_email(form):
  """Function sends email to all users that match query"""
  for user in db(db.auth_user.id>0).select():
    if not user.email=='testa...@foobar.com': continue
    context=dict(user=user)
    #if form.vars.approved:
    message = response.render('admin/message.html',context)
    mail.send(to=
[user.email],subject=form.vars.subject,message=message)

Mine is the test email address (real address in actual code). But I'm
never getting any email.

My server is up and running OK and an old email program that I also
wrote that uses localhost is working fine.

Any ideas where I'm going wrong?

-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.

Reply via email to