Skip to content

Commit

Permalink
Fixes part of Issue#4374 : Making changes. (#4795)
Browse files Browse the repository at this point in the history
  • Loading branch information
square-1111 authored and brianrodri committed Mar 17, 2018
1 parent 8f391e7 commit 3b1df68
Showing 1 changed file with 34 additions and 27 deletions.
61 changes: 34 additions & 27 deletions core/platform/email/gae_email_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@


def get_incoming_email_address(reply_to_id):
"""Gets the incoming email address. The client is responsible for recording
any audit logs.
Args:
reply_to_id: str. The unique id of the sender.
Returns:
str. The email address of the sender.
"""
return 'reply+%s@%s' % (reply_to_id, feconf.INCOMING_EMAILS_DOMAIN_NAME)


Expand All @@ -34,23 +43,22 @@ def send_mail(
email_manager._send_email().
Args:
- sender_email: str. the email address of the sender. This should be in
the form 'SENDER_NAME <SENDER_EMAIL_ADDRESS>'.
- recipient_email: str. the email address of the recipient.
- subject: str. The subject line of the email.
- plaintext_body: str. The plaintext body of the email.
- html_body: str. The HTML body of the email. Must fit in a datastore
entity.
- bcc_admin: bool. Whether to bcc feconf.ADMIN_EMAIL_ADDRESS on the email.
- reply_to_id: str or None. The unique reply-to id used in reply-to email
sent to recipient.
sender_email: str. The email address of the sender. This should be in
the form 'SENDER_NAME <SENDER_EMAIL_ADDRESS>'.
recipient_email: str. The email address of the recipient.
subject: str. The subject line of the email.
plaintext_body: str. The plaintext body of the email.
html_body: str. The HTML body of the email. Must fit in a datastore
entity.
bcc_admin: bool. Whether to bcc feconf.ADMIN_EMAIL_ADDRESS on the email.
reply_to_id: str or None. The unique reply-to id used in reply-to email
sent to recipient.
Raises:
Exception: if the configuration in feconf.py forbids emails from being
sent.
ValueError: if 'sender_email' or 'recipient_email' is invalid, according
to App Engine.
(and possibly other exceptions, due to mail.send_mail() failures).
ValueError: If 'sender_email' or 'recipient_email' is invalid, according
to App Engine.
Exception: If the configuration in feconf.py forbids emails from being
sent.
"""
if not feconf.CAN_SEND_EMAILS:
raise Exception('This app cannot send emails.')
Expand Down Expand Up @@ -82,20 +90,19 @@ def send_bulk_mail(
email_manager._send_email().
Args:
- sender_email: str. the email address of the sender. This should be in
the form 'SENDER_NAME <SENDER_EMAIL_ADDRESS>'.
- recipient_email: str. the email address of the recipient.
- subject: str. The subject line of the email.
- plaintext_body: str. The plaintext body of the email.
- html_body: str. The HTML body of the email. Must fit in a datastore
entity.
sender_email: str. The email address of the sender. This should be in
the form 'SENDER_NAME <SENDER_EMAIL_ADDRESS>'.
recipient_email: str. The email address of the recipient.
subject: str. The subject line of the email.
plaintext_body: str. The plaintext body of the email.
html_body: str. The HTML body of the email. Must fit in a datastore
entity.
Raises:
Exception: if the configuration in feconf.py forbids emails from being
sent.
ValueError: if 'sender_email' or 'recipient_email' is invalid, according
to App Engine.
(and possibly other exceptions, due to mail.send_mail() failures).
ValueError: If 'sender_email' or 'recipient_email' is invalid, according
to App Engine.
Exception: If the configuration in feconf.py forbids emails from being
sent.
"""
if not feconf.CAN_SEND_EMAILS:
raise Exception('This app cannot send emails.')
Expand Down

0 comments on commit 3b1df68

Please sign in to comment.