mirror of https://github.com/caronc/apprise
Mailgun to support `from=` for consistency with `email://` (#711)
parent
c13bf84d03
commit
b3cca772f6
|
@ -160,6 +160,9 @@ class NotifyMailgun(NotifyBase):
|
|||
'type': 'string',
|
||||
'map_to': 'from_name',
|
||||
},
|
||||
'from': {
|
||||
'alias_of': 'name',
|
||||
},
|
||||
'region': {
|
||||
'name': _('Region Name'),
|
||||
'type': 'choice:string',
|
||||
|
@ -642,6 +645,12 @@ class NotifyMailgun(NotifyBase):
|
|||
results['from_name'] = \
|
||||
NotifyMailgun.unquote(results['qsd']['name'])
|
||||
|
||||
# Support from= for consistency with `mail://`
|
||||
elif 'from' in results['qsd'] and len(results['qsd']['from']):
|
||||
# Extract from name to associate with from address
|
||||
results['from_name'] = \
|
||||
NotifyMailgun.unquote(results['qsd']['name'])
|
||||
|
||||
if 'region' in results['qsd'] and len(results['qsd']['region']):
|
||||
# Extract from name to associate with from address
|
||||
results['region_name'] = \
|
||||
|
|
|
@ -107,6 +107,12 @@ apprise_url_tests = (
|
|||
'a' * 32, 'b' * 8, 'c' * 8), {
|
||||
'instance': NotifyMailgun,
|
||||
}),
|
||||
# We can use the `from=` directive as well:
|
||||
('mailgun://user@localhost.localdomain/{}-{}-{}'
|
||||
'?:from=Chris&:status=admin'.format(
|
||||
'a' * 32, 'b' * 8, 'c' * 8), {
|
||||
'instance': NotifyMailgun,
|
||||
}),
|
||||
# bcc and cc
|
||||
('mailgun://user@localhost.localdomain/{}-{}-{}'
|
||||
'?bcc=user@example.com&cc=user2@example.com'.format(
|
||||
|
|
Loading…
Reference in New Issue