0

I'm trying to send a mail in web2py but nothing happens.

Here is my code:

from gluon.tools import Mail
mail = Mail()

def sendMail():
    mail.settings.server = 'smtp.yahoo.com:465'
    mail.settings.sender = 'mymail@yahoo.com'
    mail.settings.login  = 'abc:password'
    mail.send(to='a@gmail.com', subject='Hello', message='You've received a mail.')

Does anyone have any ideea what I'm doing wrong?

spoke
  • 257
  • 1
  • 6
  • 19

1 Answers1

0

Have you tried changing your mail.send to:

 mail.send(to='a@gmail.com', subject='Hello', message="You've received a mail.")

It seems like a simple SyntaxError, because you're defining your message string with a single quote, and you're using a single quote at You've, which is making `message='You' and the rest (ve received a mail....) a SyntaxError and using double quotes should fix it.

Diogo Martins
  • 917
  • 7
  • 15