Email 在web2py上设置带有私人消息的电子邮件通知

Email 在web2py上设置带有私人消息的电子邮件通知,email,notifications,message,private,web2py,Email,Notifications,Message,Private,Web2py,我用web2py建立了一个网站,我正在寻找帮助来设置一个电子邮件通知,当他们收到私人消息时,会给他们发电子邮件。 我已经有了一个半消息系统/私人消息的系统,我想知道如何将这些整合在一起,以便如果一个人收到消息,系统可以自动向该用户发送电子邮件。我一直在寻找如何设置它,但我自己没有运气 多谢各位 编辑:在我开始尝试集成消息传递系统之前,我想通过注册来测试它,因为这是我唯一能找到的关于web2py和电子邮件通知的东西 编辑2:登记簿开始工作了,上面写着“电子邮件已发送”。但是,没有实际发送电子邮件

我用web2py建立了一个网站,我正在寻找帮助来设置一个电子邮件通知,当他们收到私人消息时,会给他们发电子邮件。 我已经有了一个半消息系统/私人消息的系统,我想知道如何将这些整合在一起,以便如果一个人收到消息,系统可以自动向该用户发送电子邮件。我一直在寻找如何设置它,但我自己没有运气

多谢各位

编辑:在我开始尝试集成消息传递系统之前,我想通过注册来测试它,因为这是我唯一能找到的关于web2py和电子邮件通知的东西

编辑2:登记簿开始工作了,上面写着“电子邮件已发送”。但是,没有实际发送电子邮件

这些都在模型中,menu.py。还尝试将其放入控制器default.py中

auth.settings.register_next = URL('Welcome')
def Welcome():
User_Email = auth.user.email
mail.send(User_Email,'Welcome To website','Welcome To website')
if request.vars.lan == 'En':
    redirect('index',vars={'lan':'En'})
else:
    redirect('index')
#from gluon.tools import Mail
#mail = Mail()
#mail.settings. = True
#mail = auth.settings.mailer
mail = auth.settings.mailer
mail.settings.tls = False
mail.settings.server = "tls://smtp.gmail.com:587"
mail.settings.sender = "...@gmail.com"
mail.settings.login = "...@gmail.com:password"

# sends an verification e-mail upon registration
auth.settings.registration_requires_verification = True


def send_email(user, subject):
message = "" "Multi line string for %(first_name)s......"
message = open("somefile.html", "r").read()
# you also have the option to include everyone in bcc=[...]
mail.send(to=user.email,
               subject=subject,
               message=message % user)

user = db(db.auth_user).select()
for user in user:
    send_email(user, "some subject")
在controller/default.py中也有

def login():
auth.settings.registration_requires_verification = True
auth.settings.registration_requires_approval = False
auth.settings.reset_password_requires_verification = True

你有没有看过有关的文件?如果是,您尝试过什么,遇到了什么问题?如果问题是如何根据收到的私人邮件触发电子邮件发送,那么在不了解您的私人邮件实现的情况下,将很难提供帮助。我现在尝试让电子邮件功能正常工作,但在我注册时,它似乎无法发送电子邮件。我只是想设置它,这样当你注册时它会结束一封电子邮件,因为这是我唯一能找到的关于如何设置web2py的电子邮件通知的方法。考虑到你是通过Gmail帐户发送的,您是否有
mail.settings.server='smtp.gmail.com:587'
?只需将其设置为“smtp.gmail.com:587”,它仍然会给我一个错误,即无法发送电子邮件。您必须
打开
访问不太安全的应用程序。对于Gmail,你可以从这里开始