I am facing an issue where all of my text e-mails are scrunched together and do not have new lines persisting through the sending process.
Here is the code:
def send_ses_message(email_to, subject, body):
ses = init_ses_internal()
if ses:
ses.send_email(
Source='no-reply@domain.com',
Destination={
'ToAddresses': [
email_to,
],
},
Message={
'Subject': {
'Data': subject,
},
'Body': {
'Text': {
'Data': body,
'Charset': 'UTF-8',
},
'Html': {
'Data': body,
'Charset': 'UTF-8',
},
}
},
ReplyToAddresses=[
'mharris@domain.com', # just in case someone replies to a no-reply@ address I'll receive them
],
ReturnPath='mharris@domain.com', # bounce backs will come to me also
)
return True
I have most recently tried forcing UTF-8 hoping that would allow the newlines to persist. After that I added \n where a new line should exist.
Here is an example of a email:
def send_reset_email(self, email_to, unique_id):
subject = "Company Password Reset"
body = """
Hello!\n\n
We have received a request to reset your password.\n
Please click the link below to proceed with resetting your password. Note: this link will expire in 1 hour.\n\n
http://staging.domain.com/password/reset/{}\n\n
If you did not request this reset you can safely ignore this e-mail.\n\n
Thank you for choosing Company!\n\n
The Company Team\n
www.company.com\n
""".format(unique_id)
send_ses_message(email_to, subject, body)
Please let me know what I can do to ensure that newlines are persistent across Amazon SES. Thanks!