mirror of
https://github.com/GSA/notifications-api.git
synced 2026-05-05 16:48:31 -04:00
Send emails with a friendly from name
It’s nicer to have emails with a sender name, as well as the raw email address. Amazon SES can acheive this by using the format ``` "Sender name" <sender.name@domain.com> ``` — http://docs.aws.amazon.com/ses/latest/DeveloperGuide/email-format.html We also have to remove all non-ASCII characters from the sender name, because SMTP only supports 7-bit ASCII: > A field name MUST be composed of printable US-ASCII characters (i.e., > characters that have values between 33 and 126, inclusive), except > colon. — http://www.ietf.org/rfc/rfc5322.txt We use the service name as the sender name when: - sending emails from the API - sending emails from a CSV file We use GOV.UK Notify as the sender name when: - sending invitation emails - sending password reset emails
This commit is contained in:
@@ -359,7 +359,7 @@ def send_notification(notification_type):
|
||||
send_email.apply_async((
|
||||
service_id,
|
||||
notification_id,
|
||||
"{}@{}".format(service.email_from, current_app.config['NOTIFY_EMAIL_DOMAIN']),
|
||||
'"{}" <{}@{}>'.format(service.name, service.email_from, current_app.config['NOTIFY_EMAIL_DOMAIN']),
|
||||
encryption.encrypt(notification),
|
||||
datetime.utcnow().strftime(DATETIME_FORMAT)
|
||||
), queue='email')
|
||||
|
||||
Reference in New Issue
Block a user