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()
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
'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('run', db.run, requires = IS_NOT_EMPTY()),
Field('notify_when', requires = IS_IN_SET(['Requested', 'In Proccess', 'Completed'])),
Field('notified', 'boolean', default = False, readable = False),
Field('user_signature', db.auth_user, compute = lambda row: auth.user_id))
And the relevant field form the run table:
Field('status', requires = IS_EMPTY_OR(IS_IN_SET(['Requested', 'In Proccess', 'Completed']))),