In the book it mentions sending message.html to every person in the 
database. I know you know where it is already but for posterity 
sake...http://web2py.com/books/default/chapter/29/8.

There now seems to be a problem with my code as it only sends the first 
mail.send and not the other. I really would like to take the 
form.vars.email and send them message.html that is a template with their 
login info and how to login as well as some other form.vars I have in the 
form they fill out.

My controller:

def new_post():
    form = SQLFORM(db.post)
    if form.accepts(request, formname=None):
        mail.send(to=['[email protected]'],subject='New Registration at 
RKS',message=', '.join('%s: %s' % (k, v) for (k, v) in 
request.vars.iteritems()))
        mail.send(to=['form.vars.email'],subject='Your Registration 
Details',message=response.render('new_user.html'))
        return DIV("Test")
    elif form.errors:
        return TABLE(*[TR(k, v) for k, v in form.errors.items()])

My view:

<form id="form_post_test" method="post" action="">
    <label for="firstname">First Name <sup>*</sup></label><input 
name="firstname" id="firstname" type="text" placeholder="First Name" />
    <label for="lastname">Last Name <sup>*</sup></label><input 
name="lastname" id="lastname" type="text" placeholder="Last Name" />
    <label for="email">Email <sup>*</sup></label><input class="email text" 
name="email" id="email" placeholder="Email" />
    <input type="submit" value="Send" />
</form>

It seems my default code does not recognize form.vars.email because I'm not 
defining it in the form inside the controller? That's the only thing I can 
think of there. Plus I realize now that I'm not going to get vars from one 
view in another or auth.user vars from a non-logged in user? Correct?

Reply via email to