diff --git a/make_post_sell/lib/mail.py b/make_post_sell/lib/mail.py index 7ac42d4..4872408 100644 --- a/make_post_sell/lib/mail.py +++ b/make_post_sell/lib/mail.py @@ -17,6 +17,8 @@ from make_post_sell.lib.mail_messages import ( PURCHASE_1_HTML, SALE_1_TEXT, SALE_1_HTML, + INVITE_1_TEXT, + INVITE_1_HTML, ) @@ -33,7 +35,7 @@ def send_verification_digits_to_email(request, to_email, raw_digits): raw_digits: the raw (unencrypted) digits the user may use to verify & authenticate. """ - subject = "Verification Code" + subject = "Verification Code | {}".format(raw_digits) message_text = WELCOME_1_TEXT.format(raw_digits) message_html = WELCOME_1_HTML.format(subject, raw_digits) send_pyramid_email(request, to_email, subject, message_text, message_html) @@ -126,3 +128,26 @@ def send_sale_email(request, shop, products, total_cost): # send a separate email for each shop owner. for user in shop.users: send_pyramid_email(request, user.email, subject, message_text, message_html) + + +def send_invite_email(request, to_email, user, shop): + """ + Send an email to all shop owners regarding the sale. + + request + the request (of the successful log in attempt) + + to_email + the email address to send the shop invitation to. + + user + the user who sent the invite. + + shop + the shop the invitation is for. + """ + subject = "You have been invited to {}".format(shop.name) + join_link = request.route_url("join-or-log-in") + message_text = INVITE_1_TEXT.format(user.email, shop.name, join_link) + message_html = INVITE_1_HTML.format(subject, user.email, shop.name, join_link) + send_pyramid_email(request, to_email, subject, message_text, message_html) diff --git a/make_post_sell/lib/mail_messages.py b/make_post_sell/lib/mail_messages.py index 72d7e4e..306cf0c 100644 --- a/make_post_sell/lib/mail_messages.py +++ b/make_post_sell/lib/mail_messages.py @@ -1,11 +1,10 @@ WELCOME_1_TEXT = """ Hey there! -Here is the verification code you requested: - \n{0}\n -Type code into the challenge input field: +Here is the verification code you requested. +Type code into the challenge input field. """ WELCOME_1_HTML = """ @@ -17,13 +16,10 @@ WELCOME_1_HTML = """
- Here is the verification code you requested: -
-{1}
+ Here is the verification code you requested. Type code into the challenge input field.
@@ -146,3 +142,60 @@ SALE_1_HTML = """