mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-23 10:51:24 -07:00
[PR #7765/acddb190 backport][stable-8] mail module/callback: allow to configure the Message-ID header's domain name (#7805)
mail module/callback: allow to configure the Message-ID header's domain name (#7765)
Allow to configure the Message-ID header's domain name.
(cherry picked from commit acddb190ba
)
Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
42c65f32eb
commit
395fc1e77a
3 changed files with 24 additions and 2 deletions
|
@ -71,6 +71,16 @@ options:
|
|||
ini:
|
||||
- section: callback_mail
|
||||
key: bcc
|
||||
message_id_domain:
|
||||
description:
|
||||
- The domain name to use for the L(Message-ID header, https://en.wikipedia.org/wiki/Message-ID).
|
||||
- The default is the hostname of the control node.
|
||||
type: str
|
||||
ini:
|
||||
- section: callback_mail
|
||||
key: message_id_domain
|
||||
version_added: 8.2.0
|
||||
|
||||
'''
|
||||
|
||||
import json
|
||||
|
@ -131,7 +141,7 @@ class CallbackModule(CallbackBase):
|
|||
content += 'To: %s\n' % ', '.join([email.utils.formataddr(pair) for pair in to_addresses])
|
||||
if self.cc:
|
||||
content += 'Cc: %s\n' % ', '.join([email.utils.formataddr(pair) for pair in cc_addresses])
|
||||
content += 'Message-ID: %s\n' % email.utils.make_msgid()
|
||||
content += 'Message-ID: %s\n' % email.utils.make_msgid(domain=self.get_option('message_id_domain'))
|
||||
content += 'Subject: %s\n\n' % subject.strip()
|
||||
content += body
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue