myl-discovery 0.1.0__tar.gz → 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {myl-discovery-0.1.0 → myl-discovery-0.2.0}/PKG-INFO +4 -3
- {myl-discovery-0.1.0 → myl-discovery-0.2.0}/README.md +3 -2
- {myl-discovery-0.1.0 → myl-discovery-0.2.0}/myl_discovery.egg-info/PKG-INFO +4 -3
- {myl-discovery-0.1.0 → myl-discovery-0.2.0}/myldiscovery/__init__.py +39 -16
- {myl-discovery-0.1.0 → myl-discovery-0.2.0}/pyproject.toml +1 -1
- {myl-discovery-0.1.0 → myl-discovery-0.2.0}/.github/dependabot.yml +0 -0
- {myl-discovery-0.1.0 → myl-discovery-0.2.0}/.github/workflows/lint.yaml +0 -0
- {myl-discovery-0.1.0 → myl-discovery-0.2.0}/.github/workflows/release.yaml +0 -0
- {myl-discovery-0.1.0 → myl-discovery-0.2.0}/.gitignore +0 -0
- {myl-discovery-0.1.0 → myl-discovery-0.2.0}/LICENSE +0 -0
- {myl-discovery-0.1.0 → myl-discovery-0.2.0}/myl_discovery.egg-info/SOURCES.txt +0 -0
- {myl-discovery-0.1.0 → myl-discovery-0.2.0}/myl_discovery.egg-info/dependency_links.txt +0 -0
- {myl-discovery-0.1.0 → myl-discovery-0.2.0}/myl_discovery.egg-info/requires.txt +0 -0
- {myl-discovery-0.1.0 → myl-discovery-0.2.0}/myl_discovery.egg-info/top_level.txt +0 -0
- {myl-discovery-0.1.0 → myl-discovery-0.2.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: myl-discovery
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.2.0
|
4
4
|
Summary: email autodiscovery
|
5
5
|
Author-email: Philipp Schmitt <philipp@schmitt.co>
|
6
6
|
License: GNU GENERAL PUBLIC LICENSE
|
@@ -694,12 +694,13 @@ Email autoconfig library
|
|
694
694
|
pip install myl-discovery
|
695
695
|
```
|
696
696
|
|
697
|
-
## Usage
|
697
|
+
## Usage
|
698
698
|
|
699
699
|
```python
|
700
700
|
from myldiscovery import autodiscover
|
701
701
|
autodiscover("me@example.com")
|
702
|
-
# {'server': 'mail.example.com', 'port':
|
702
|
+
# {'imap': {'server': 'mail.example.com', 'port': 993, 'starttls': False},
|
703
|
+
# 'smtp': {'server': 'mail.example.com', 'port': 587, 'starttls': False}}
|
703
704
|
```
|
704
705
|
|
705
706
|
|
@@ -8,12 +8,13 @@ Email autoconfig library
|
|
8
8
|
pip install myl-discovery
|
9
9
|
```
|
10
10
|
|
11
|
-
## Usage
|
11
|
+
## Usage
|
12
12
|
|
13
13
|
```python
|
14
14
|
from myldiscovery import autodiscover
|
15
15
|
autodiscover("me@example.com")
|
16
|
-
# {'server': 'mail.example.com', 'port':
|
16
|
+
# {'imap': {'server': 'mail.example.com', 'port': 993, 'starttls': False},
|
17
|
+
# 'smtp': {'server': 'mail.example.com', 'port': 587, 'starttls': False}}
|
17
18
|
```
|
18
19
|
|
19
20
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: myl-discovery
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.2.0
|
4
4
|
Summary: email autodiscovery
|
5
5
|
Author-email: Philipp Schmitt <philipp@schmitt.co>
|
6
6
|
License: GNU GENERAL PUBLIC LICENSE
|
@@ -694,12 +694,13 @@ Email autoconfig library
|
|
694
694
|
pip install myl-discovery
|
695
695
|
```
|
696
696
|
|
697
|
-
## Usage
|
697
|
+
## Usage
|
698
698
|
|
699
699
|
```python
|
700
700
|
from myldiscovery import autodiscover
|
701
701
|
autodiscover("me@example.com")
|
702
|
-
# {'server': 'mail.example.com', 'port':
|
702
|
+
# {'imap': {'server': 'mail.example.com', 'port': 993, 'starttls': False},
|
703
|
+
# 'smtp': {'server': 'mail.example.com', 'port': 587, 'starttls': False}}
|
703
704
|
```
|
704
705
|
|
705
706
|
|
@@ -44,21 +44,36 @@ def autodiscover_txt(domain):
|
|
44
44
|
return res.split("=")[1]
|
45
45
|
|
46
46
|
|
47
|
-
def autodiscover(email_addr):
|
47
|
+
def autodiscover(email_addr, srv_only=False):
|
48
48
|
domain = email_addr.split("@")[-1]
|
49
49
|
if not domain:
|
50
50
|
raise ValueError(f"Invalid email address {email_addr}")
|
51
51
|
|
52
|
-
autoconfig = autodiscover_txt(domain)
|
52
|
+
autoconfig = autodiscover_txt(domain) if not srv_only else None
|
53
53
|
|
54
54
|
if not autoconfig:
|
55
|
-
|
55
|
+
imap = resolve_srv(f"_imaps._tcp.{domain}")
|
56
|
+
smtp = resolve_srv(f"_submission._tcp.{domain}")
|
57
|
+
|
56
58
|
return {
|
57
|
-
"
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
59
|
+
"imap": {
|
60
|
+
"server": imap[0].get("hostname"),
|
61
|
+
"port": int(imap[0].get("port")),
|
62
|
+
# FIXME We might want to "smartly" guess if starttls should be
|
63
|
+
# enabled or not, depending on the port:
|
64
|
+
# 143 -> starttls
|
65
|
+
# 993 -> no
|
66
|
+
"starttls": False,
|
67
|
+
},
|
68
|
+
"smtp": {
|
69
|
+
"server": smtp[0].get("hostname"),
|
70
|
+
"port": int(smtp[0].get("port")),
|
71
|
+
# FIXME We might want to "smartly" guess if starttls should be
|
72
|
+
# enabled or not, depending on the port:
|
73
|
+
# 465 -> starttls
|
74
|
+
# 587 -> no
|
75
|
+
"starttls": False,
|
76
|
+
}
|
62
77
|
}
|
63
78
|
|
64
79
|
res = requests.get(autoconfig)
|
@@ -70,16 +85,24 @@ def autodiscover(email_addr):
|
|
70
85
|
.get("emailProvider", {})
|
71
86
|
.get("incomingServer")
|
72
87
|
)
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
88
|
+
smtp = (
|
89
|
+
data.get("clientConfig", {})
|
90
|
+
.get("emailProvider", {})
|
91
|
+
.get("outgoingServer")
|
92
|
+
)
|
78
93
|
|
79
94
|
assert imap is not None
|
95
|
+
assert smtp is not None
|
80
96
|
|
81
97
|
return {
|
82
|
-
"
|
83
|
-
|
84
|
-
|
98
|
+
"imap": {
|
99
|
+
"server": imap.get("hostname"),
|
100
|
+
"port": int(imap.get("port")),
|
101
|
+
"starttls": imap.get("socketType") == "STARTTLS",
|
102
|
+
},
|
103
|
+
"smtp": {
|
104
|
+
"server": smtp.get("hostname"),
|
105
|
+
"port": int(smtp.get("port")),
|
106
|
+
"starttls": smtp.get("socketType") == "STARTTLS",
|
107
|
+
},
|
85
108
|
}
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|