Almost done
This commit is contained in:
@@ -1,9 +1,22 @@
|
|||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
import yaml
|
import yaml
|
||||||
|
MG_URL="https://api.mailgun.net/v3/routes"
|
||||||
|
MG_APIKEY="api:key-6e4b01ba0681141a509c1c462fca40f4"
|
||||||
|
HEADER="curl -s --user "+MG_APIKEY+" -X PUT \""+MG_URL
|
||||||
|
#print (HEADER)
|
||||||
f = open('rules.yaml')
|
f = open('rules.yaml')
|
||||||
|
EXE = open('ModifyRules.sh','w')
|
||||||
dohicky = yaml.safe_load(f)
|
dohicky = yaml.safe_load(f)
|
||||||
|
EXE.writelines("#!/bin/bash\n")
|
||||||
for i in dohicky:
|
for i in dohicky:
|
||||||
print(i)
|
CHAINE=HEADER+"/"+i['id']+ "\" -F priority="+str(i['priority'])
|
||||||
|
if len(i['description'])>0:
|
||||||
|
CHAINE=CHAINE+ " -F description='"+str(i['description'])+"'"
|
||||||
|
CHAINE=CHAINE+ " -F expression='"+str(i['expression'])+"'"
|
||||||
|
for j in i['actions']:
|
||||||
|
CHAINE=CHAINE+ " -F action='"+str(j)+"'"
|
||||||
|
#print(CHAINE)
|
||||||
|
EXE.writelines(CHAINE+"\n")
|
||||||
|
|
||||||
#print(dohicky)
|
f.close()
|
||||||
f.close()
|
EXE.close()
|
||||||
@@ -1,51 +1,17 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# https://documentation.mailgun.com/en/latest/api-routes.html
|
# https://documentation.mailgun.com/en/latest/api-routes.html
|
||||||
MG_USER=
|
MG_USER=
|
||||||
MG_URL="https://api.mailgun.net/v3/routes"
|
MG_URL="https://api.mailgun.net/v3/routes"
|
||||||
MG_APIKEY="api:key-6e4b01ba0681141a509c1c462fca40f4"
|
MG_APIKEY="api:key-6e4b01ba0681141a509c1c462fca40f4"
|
||||||
MG_ORDER="GET /routes"
|
MG_ORDER="GET /routes"
|
||||||
|
|
||||||
declare -A MyRules
|
|
||||||
|
|
||||||
"5ce42a14bf802e0001684668,2,Tout ce qui arrive sur le domaine pour mg.iwanclement.eu,match_recipient(".*@mg.iade-lyon.eu")
|
|
||||||
5cd48c308b3cd70001f79bfb
|
|
||||||
5cd48b47a4764a00013cee72
|
|
||||||
5db1e61d11c830a64e8e2dba
|
|
||||||
5ce18c92629574000195c8de
|
|
||||||
5ca2330d6295740001322814
|
|
||||||
5c726e2f8b3cd70001237ee5
|
|
||||||
5c570e59bf802e00012989e9
|
|
||||||
5baa01368ecd8700013c5010
|
|
||||||
5b6d4d826295740001913849
|
|
||||||
5b6d4c278b3cd70001ebdfda
|
|
||||||
5c5499376295740001fe1e27
|
|
||||||
5c5343c345d85900018ceee6
|
|
||||||
5c5eb3376295740001546abf
|
|
||||||
5c534e78bf802e00013232e5
|
|
||||||
5bbe45dc6295740001b26ffd
|
|
||||||
5b9b758aa4764a000133bfbe
|
|
||||||
5bae76a745d8590001287978
|
|
||||||
5b8d79f98b3cd700019d5205
|
|
||||||
5b799e80a4764a000192cf3b
|
|
||||||
5c726e7e8ecd870001264998
|
|
||||||
5c726b408ecd870001264739
|
|
||||||
5c726b19bf802e000162d921
|
|
||||||
5c419a518b3cd70001c5ddea
|
|
||||||
5b8a5bcd8b3cd700017130ed
|
|
||||||
5ce18d97bf802e00019eaace
|
|
||||||
5ce18cf4a4764a0001d95b58
|
|
||||||
5baf5ac78b3cd70001ebae82
|
|
||||||
5b6cbd328b3cd70001eb4eb2
|
|
||||||
|
|
||||||
for i in "${MyRules[@]}"; do echo "$i"; done
|
|
||||||
for i in "${MyRules[*]}"; do echo "$i"; done
|
|
||||||
|
|
||||||
curl -s --user $MG_APIKEY -X PUT \
|
curl -s --user $MG_APIKEY -X PUT \
|
||||||
"$MG_URL/5ce18c92629574000195c8de" \
|
"$MG_URL/5ce18c92629574000195c8de" \
|
||||||
-F priority=2 \
|
-F priority=2 \
|
||||||
-F description='Tout ce qui arrive sur le domaine pour mg.iwanclement.eu' \
|
-F description='Tout ce qui arrive sur le domaine pour mg.iwanclement.eu' \
|
||||||
-F expression='match_recipient(".*@mg.iade-lyon.eu")' \
|
-F expression='match_recipient(".*@mg.iade-lyon.eu")' \
|
||||||
-F action='forward("iwan.pubclement@gmx.fr")' \
|
-F action='forward("iwan.pubclement@mail.fr")' \
|
||||||
-F action='stop()'
|
-F action='stop()'
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
@@ -1,10 +1,17 @@
|
|||||||
---
|
---
|
||||||
- id: 5ce42a14bf802e0001684668
|
- id: 5ce42a14bf802e0001684668
|
||||||
actions:
|
actions:
|
||||||
- store()
|
- forward("gwladys.clement@gmail.com")
|
||||||
- stop()
|
- stop()
|
||||||
description: Suppression UDEMY
|
description: Tout pour Gwladys sur space
|
||||||
expression: match_recipient("iwan*.udemy@mg.*.space")
|
expression: match_recipient("gwladys.*@mg.*.space")
|
||||||
|
priority: 0
|
||||||
|
- id: 5c726e2f8b3cd70001237ee5
|
||||||
|
actions:
|
||||||
|
- forward("ophelie.clement@gmail.com")
|
||||||
|
- stop()
|
||||||
|
description: Tout pour Ophelie sur space
|
||||||
|
expression: match_recipient("ophelie.*@mg.*.space")
|
||||||
priority: 0
|
priority: 0
|
||||||
- id: 5cd48c308b3cd70001f79bfb
|
- id: 5cd48c308b3cd70001f79bfb
|
||||||
actions:
|
actions:
|
||||||
@@ -29,25 +36,18 @@
|
|||||||
priority: 1
|
priority: 1
|
||||||
- id: 5ce18c92629574000195c8de
|
- id: 5ce18c92629574000195c8de
|
||||||
actions:
|
actions:
|
||||||
- forward("iwan.pubclement@gmx.fr")
|
- forward("nadineclement@mail.fr")
|
||||||
- stop()
|
- stop()
|
||||||
description: Tout ce qui arrive sur le domaine pour mg.iwanclement.eu
|
description: Tout ce qui arrive sur le domaine pour mg.iade-lyon.eu
|
||||||
expression: match_recipient(".*@mg.iade-lyon.eu")
|
expression: match_recipient(".*@mg.iade-lyon.eu")
|
||||||
priority: 2
|
priority: 2
|
||||||
- id: 5ca2330d6295740001322814
|
- id: 5ca2330d6295740001322814
|
||||||
actions:
|
actions:
|
||||||
- forward("iwan.pubclement@mail.fr, nadinepub.clement@free.fr")
|
- forward("iwan.pubclement@mail.fr, nadineclement@mail.fr")
|
||||||
- stop()
|
- stop()
|
||||||
description: LIDL
|
description: LIDL
|
||||||
expression: match_recipient("iwanpub.lidl@mg.*.space")
|
expression: match_recipient("iwanpub.lidl@mg.*.space")
|
||||||
priority: 2
|
priority: 2
|
||||||
- id: 5c726e2f8b3cd70001237ee5
|
|
||||||
actions:
|
|
||||||
- forward("nadineclement@mail.fr")
|
|
||||||
- stop()
|
|
||||||
description: Tout pour Nadine Clement
|
|
||||||
expression: match_recipient(".*@mg.iade-lyon.eu")
|
|
||||||
priority: 2
|
|
||||||
- id: 5c570e59bf802e00012989e9
|
- id: 5c570e59bf802e00012989e9
|
||||||
actions:
|
actions:
|
||||||
- forward("iwanpro.clement@free.fr")
|
- forward("iwanpro.clement@free.fr")
|
||||||
@@ -197,10 +197,9 @@
|
|||||||
priority: 8
|
priority: 8
|
||||||
- id: 5b6cbd328b3cd70001eb4eb2
|
- id: 5b6cbd328b3cd70001eb4eb2
|
||||||
actions:
|
actions:
|
||||||
- forward("iwan.pubclement@gmx.fr")
|
- forward("iwan.pubclement@mail.fr")
|
||||||
- stop()
|
- stop()
|
||||||
description: On ramasse tout
|
description: On ramasse tout
|
||||||
expression: catch_all()
|
expression: catch_all()
|
||||||
id:
|
|
||||||
priority: 10
|
priority: 10
|
||||||
...
|
...
|
||||||
Reference in New Issue
Block a user