Send mail even if the user is already registered
This commit is contained in:
+19
-19
@@ -644,27 +644,27 @@ def participer(request):
|
|||||||
DBSession.flush()
|
DBSession.flush()
|
||||||
MyLink = TmpUsr.my_hash
|
MyLink = TmpUsr.my_hash
|
||||||
|
|
||||||
mailer = request.registry['mailer']
|
mailer = request.registry['mailer']
|
||||||
# Send the Welcome Mail
|
# Send the Welcome Mail
|
||||||
NewUser = TmpUsr
|
NewUser = TmpUsr
|
||||||
# Prepare Plain Text Message :
|
# Prepare Plain Text Message :
|
||||||
Mail_template = Template(filename='jm2l/templates/mail_plain.mako')
|
Mail_template = Template(filename='jm2l/templates/mail_plain.mako')
|
||||||
mail_plain = Mail_template.render(User=NewUser, action="Welcome")
|
mail_plain = Mail_template.render(User=NewUser, action="Welcome")
|
||||||
body = Attachment(data=mail_plain, transfer_encoding="quoted-printable")
|
body = Attachment(data=mail_plain, transfer_encoding="quoted-printable")
|
||||||
|
|
||||||
# Prepare HTML Message :
|
# Prepare HTML Message :
|
||||||
Mail_template = Template(filename='jm2l/templates/mail_html.mako')
|
Mail_template = Template(filename='jm2l/templates/mail_html.mako')
|
||||||
mail_html = Mail_template.render(User=NewUser, action="Welcome")
|
mail_html = Mail_template.render(User=NewUser, action="Welcome")
|
||||||
html = Attachment(data=mail_html, transfer_encoding="quoted-printable")
|
html = Attachment(data=mail_html, transfer_encoding="quoted-printable")
|
||||||
|
|
||||||
# Prepare Message
|
# Prepare Message
|
||||||
message = Message(subject="[JM2L] Mon inscription au site web JM2L",
|
message = Message(subject="[JM2L] Mon inscription au site web JM2L",
|
||||||
sender="contact@jm2l.linux-azur.org",
|
sender="contact@jm2l.linux-azur.org",
|
||||||
recipients=[NewUser.mail],
|
recipients=[NewUser.mail],
|
||||||
body=body, html=html)
|
body=body, html=html)
|
||||||
|
|
||||||
message.add_bcc("spam@style-python.fr")
|
message.add_bcc("spam@style-python.fr")
|
||||||
mailer.send(message)
|
mailer.send(message)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1067,4 +1067,4 @@ def forbidden(reason, request):
|
|||||||
#return Response('forbidden')
|
#return Response('forbidden')
|
||||||
request.response.status = 404
|
request.response.status = 404
|
||||||
return render_to_response('jm2l:templates/Errors/404.mak', { "reason":reason },
|
return render_to_response('jm2l:templates/Errors/404.mak', { "reason":reason },
|
||||||
request=request)
|
request=request)
|
||||||
|
|||||||
Reference in New Issue
Block a user