Date header not set in default A/T email templates

Bug #1593834 reported by Jason Boyer
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
Evergreen
Fix Released
Low
Unassigned

Bug Description

There are 27 A/T templates in the stock data that send email (24 "plain" email, 3 SMS) and none define the Date: header. This header is required according to RFC 822 and it's successor, 2822, and when absent, you may see unusual results depending on your email client. Some will default to a "0" timestamp, or 1/1/1970 00:00:00 UTC, and may send your new messages to the farthest reaches of your inbox where they'll probably never be seen. Clients that only ever show the date received don't appear to have any issues, which is likely why this has persisted so long. I've got a branch incoming that addresses this for the stock templates.

To correct this issue for your custom templates, or in stock templates for databases built before this is released, make sure the following 2 lines are in every action_trigger.event_definition template field that has a SendEmail or SendSMS reactor:

[%- USE date -%]

Date: [%- date.format(date.now, '%a, %d %b %Y %H:%M:%S -0000', gmt => 1) %]

The first is likely there already since many email templates already do /something/ with dates. The second specifically chooses to use UTC as the timezone, but using -0000 rather than +0000 implies that UTC is not the actual local time, since I don't know how to get the current offset in a TT2 template and %Z (or whatever the proper strftime formatter is, I don't have it in front of me) doesn't work. The order doesn't matter in any mail server worth using in 2016, but the Date: line does need to be within the header block.

Branch should be ready Monday.

Tags: pullrequest
Revision history for this message
Jason Boyer (jboyer) wrote :
tags: added: pullrequest
Changed in evergreen:
milestone: none → 2.next
Revision history for this message
Thomas Berezansky (tsbere) wrote :

As a quick question:

If the date header is required, should the SendEmail/SendSMS reactors just add it in the background so that we don't have to worry about the templates providing it?

Revision history for this message
Jason Boyer (jboyer) wrote :

That would be a possibility. In theory we could move all of the headers out of the templates and require that the sender, recipient, and subject be parameters (not 100% certain how easy that is for the recipient in this case) but I didn't want to start doing that for some of them and not others. If Date is automatic, Auto-Generated or whatever it's called should probably also be automatic, etc. I'm not opposed to that in the future but this is what I could manage currently.

Revision history for this message
Mike Rylander (mrylander) wrote :

Picked to master and 2.10; I see this as a seed data bug.

Thanks, Jason!

Changed in evergreen:
status: New → Fix Committed
Changed in evergreen:
milestone: 2.next → 2.11-beta
Changed in evergreen:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.