wip
This commit is contained in:
commit
6c8288945b
24
main.py
Normal file
24
main.py
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# A script to automatically add mail hosts with dynamic DNS to Mailcow.
|
||||||
|
# Please add it to the crontab of a user on your *Mailcow* server.
|
||||||
|
# Environment variables:
|
||||||
|
# MAILCOW_AWL_HOSTS: the DNS hosts you want to add, comma-separated
|
||||||
|
# MAILCOW_AWL_NOTIFY: the e-mail you want to receive notifications at. This is mandatory
|
||||||
|
# MAILCOW_AWL_NOTIFY:
|
||||||
|
import requests
|
||||||
|
import json
|
||||||
|
import dns.query
|
||||||
|
import os
|
||||||
|
from typing import List
|
||||||
|
import smtplib
|
||||||
|
|
||||||
|
class Config(object):
|
||||||
|
hosts: List[str]
|
||||||
|
notify_email: str
|
||||||
|
api_key: str
|
||||||
|
def __init__(self):
|
||||||
|
hosts = os.getenv('MAILCOW_AWL_HOSTS')
|
||||||
|
if hosts:
|
||||||
|
self.hosts = hosts.split(',')
|
||||||
|
self.hosts = os.getenv('MAILCOW_AWL_HOSTS').split(',')
|
||||||
|
self.notify_email = os.environ('MAILCOW_AWL_NOTIFY')
|
2
requirements.txt
Normal file
2
requirements.txt
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
dnspython
|
||||||
|
requests
|
Loading…
Reference in New Issue
Block a user