get_autocrypt_header
Description:
Creates a new AutocryptHeader based on the relevant Autocrypt header associated with the sender of an e-mail message.
If the message has no sender in the From: field, or has more than one sender, then this function will return null . Autocrypt should ignore the message entirely.
If there is one sender, but no single Autocrypt header is found that matches that e-mail address, a AutocryptHeader will be returned for the sender, but it will be incomplete ( see is_complete).
Note that the following types of Autocrypt headers will not be returned by this function:
- headers that do not match an address in "From:"
- unparseable headers
- headers with unknown critical attributes
- duplicate valid headers for the sender's address
The returned Autocrypt header will have its effective_date set to the earliest of either:
- the Date: header of the message or
now
(or the current time, ifnow
is null)
Parameters:
this |
a Message object. |
now |
a DateTime object, or null |
Returns:
a new AutocryptHeader object, or null if the message should be ignored for purposes of Autocrypt. |