Hello

Two problems.  First, I have no experience whatsoever with the mail system, 
but I need to use it for a request/notification system.  (when the status 
of a run changes to what a user wanted it to change to, the user gets an 
email).  The email is not being sent.  I set up email like this:

from gluon.tools import Mail
mail = Mail()
mail.settings.server = 'http://127.0.0.1:8000'
mail.settings.sender = '[email protected]'

Then I call this method in my index function, which is being accessed every 
time a run is updated, to check for updates, and wee if they match:

def check_reqnot():
    for row in db().select(db.request_notification.ALL):
        if not row.notified:
            if row.notify_when == db.run[row.run].status:
                row.notified = True
                mail.send('[email protected]',
                    'WOW!',
                    'It Worked! (HOLY CRAP)')
                response.flash = 'It should have worked'

It should be working, because when the status matches the request, I see 
the flash response, but the email is not sent (yes, I checked my junk mail 
folder).

The other odd thing is that notified stays false.

For reference here is the request_notification table:

db.define_table('request_notification',
    Field <http://127.0.0.1:8000/examples/global/vars/Field>('run', db.run, 
requires = IS_NOT_EMPTY 
<http://127.0.0.1:8000/examples/global/vars/IS_NOT_EMPTY>()),
    Field <http://127.0.0.1:8000/examples/global/vars/Field>('notify_when', 
requires = IS_IN_SET 
<http://127.0.0.1:8000/examples/global/vars/IS_IN_SET>(['Requested', 'In 
Proccess', 'Completed'])),
    Field <http://127.0.0.1:8000/examples/global/vars/Field>('notified', 
'boolean', default = False, readable = False),
    Field <http://127.0.0.1:8000/examples/global/vars/Field>('user_signature', 
db.auth_user, compute = lambda row: auth.user_id))


And the relevant field form the run table:

Field <http://127.0.0.1:8000/examples/global/vars/Field>('status', requires = 
IS_EMPTY_OR <http://127.0.0.1:8000/examples/global/vars/IS_EMPTY_OR>(IS_IN_SET 
<http://127.0.0.1:8000/examples/global/vars/IS_IN_SET>(['Requested', 'In 
Proccess', 'Completed']))),

-- 



Reply via email to