我可以在 from_name 和 from_email 字段中使用 merge_tags 吗?
Can I use merge_tags in the from_name and from_email fields?
是否可以为每个收件人自定义 from_name 和 from_email?我试过这样做但似乎没有用:
message = {
'auto_html': False,
'auto_text': False,
'bcc_address': None,
'to': {'email': recipient['email'], 'type': 'to'},
'from_name': "*|FROM_NAME|*",
'from_email': "*|FROM_EMAIL|*",
'subject': '*|SUBJECT|*',
'text': '*|BODY_TEXT|*',
'html': '*|BODY_HTML|*',
'google_analytics_campaign': None,
'google_analytics_domains': [],
'headers': {},
'important': False,
'inline_css': None,
'merge': True,
'global_merge_vars': [],
'merge_vars': {
'rcpt': recipient['email'],
'vars': [
{'name': 'SUBJECT', 'content': result["subject"]},
{'name': 'BODY_TEXT', 'content': result["text"]},
{'name': 'BODY_HTML', 'content': result["html"]},
{'name': 'FROM_NAME', 'content': result['from']['name']},
{'name': 'FROM_EMAIL', 'content': result['from']['email']}
]
},
'preserve_recipients': False,
'recipient_metadata': [],
'return_path_domain': None,
'signing_domain': None,
'subaccount': "account_id,
'tags': [],
'track_clicks': False,
'track_opens': False,
'tracking_domain': None,
'url_strip_qs': None,
'view_content_link': None,
'metadata': {}
}
这是在 Python 中完成的,我正在打电话给 messages.send。我收到错误 mandrill.ValidationError: Validation error: {"message":{"from_email":"An email address must contain a single @"}}
Currently, merge tags are supported in the from name, subject line, and body of an email only.
是否可以为每个收件人自定义 from_name 和 from_email?我试过这样做但似乎没有用:
message = {
'auto_html': False,
'auto_text': False,
'bcc_address': None,
'to': {'email': recipient['email'], 'type': 'to'},
'from_name': "*|FROM_NAME|*",
'from_email': "*|FROM_EMAIL|*",
'subject': '*|SUBJECT|*',
'text': '*|BODY_TEXT|*',
'html': '*|BODY_HTML|*',
'google_analytics_campaign': None,
'google_analytics_domains': [],
'headers': {},
'important': False,
'inline_css': None,
'merge': True,
'global_merge_vars': [],
'merge_vars': {
'rcpt': recipient['email'],
'vars': [
{'name': 'SUBJECT', 'content': result["subject"]},
{'name': 'BODY_TEXT', 'content': result["text"]},
{'name': 'BODY_HTML', 'content': result["html"]},
{'name': 'FROM_NAME', 'content': result['from']['name']},
{'name': 'FROM_EMAIL', 'content': result['from']['email']}
]
},
'preserve_recipients': False,
'recipient_metadata': [],
'return_path_domain': None,
'signing_domain': None,
'subaccount': "account_id,
'tags': [],
'track_clicks': False,
'track_opens': False,
'tracking_domain': None,
'url_strip_qs': None,
'view_content_link': None,
'metadata': {}
}
这是在 Python 中完成的,我正在打电话给 messages.send。我收到错误 mandrill.ValidationError: Validation error: {"message":{"from_email":"An email address must contain a single @"}}
Currently, merge tags are supported in the from name, subject line, and body of an email only.