Hello everyone,

I'm working on emailing a message and I'm having some unexpected issues. 
Here is my code based on the web2py book:

from gluon.tools import Mail
from report_vars import *

report_month = '7-2012'

mail = Mail()


mail.settings.server = 'smtp.gmail.com:587'
mail.settings.sender = owner_email
mail.settings.login = 'username:password'

context = dict(person = comp_owner, company = company, report_month 
=report_month
)

message = response.render('report_email.txt', context)

mail.send(to = ['u...@domain.com'], 
          subject = 'Re-Test Function from Web2py',
          message = message,
          bcc = tech_email,
          attachments = Mail.Attachment('{0}_{1}_report.pdf'.format(
company_no_spaces, report_month))
          )


When I run the code in WingIDE, I get 
NameError: name 'response' is not defined.

If I run in the web2py Shell the NameError isn't raised, but instead I get: 
HTTP: 404 NOT FOUND [invalid view (report_mail.txt)]

What gives?

-- 



Reply via email to