determine smtp server for a given email address python smtplibCalling a function of a module by using its name (a string)Are static class variables possible in Python?Finding the index of an item given a list containing it in PythonHow can I safely create a nested directory?How do I check if a string is a number (float)?How to determine a Python variable's type?How to print without newline or space?In Python, how do I determine if an object is iterable?Setting different reply-to message in Python email/smtplibWhy is “1000000000000000 in range(1000000000000001)” so fast in Python 3?
How can I use my cell phone's light as a reading light?
SOQL Query (or other means) to get the icon assigned to an object
Implicit conversion between decimals with different precisions
How to play a D major chord lower than the open E major chord on guitar?
Did William Shakespeare hide things in his writings?
Gory anime with pink haired girl escaping an asylum
Advice for making/keeping shredded chicken moist?
Does the Milky Way orbit around anything?
How to get the speed of my spaceship?
Is there a minimum amount of electricity that can be fed back into the grid?
Are "confidant" and "confident" homophones?
White's last move?
When is one 'Ready' to make Original Contributions to Mathematics?
Machine Learning Golf: Multiplication
Howto display unicode character u2026 in terminal mode in emacs
Possibility to correct pitch from digital versions of records with the hole not centered
What's the big deal about the Nazgûl losing their horses?
How predictable is $RANDOM really?
Chilling juice in copper vessel
Do intermediate subdomains need to exist?
PhD: When to quit and move on?
Why do most airliners have underwing engines, while business jets have rear-mounted engines?
My professor has told me he will be the corresponding author. Will it hurt my future career?
Is this standard Japanese employment negotiations, or am I missing something?
determine smtp server for a given email address python smtplib
Calling a function of a module by using its name (a string)Are static class variables possible in Python?Finding the index of an item given a list containing it in PythonHow can I safely create a nested directory?How do I check if a string is a number (float)?How to determine a Python variable's type?How to print without newline or space?In Python, how do I determine if an object is iterable?Setting different reply-to message in Python email/smtplibWhy is “1000000000000000 in range(1000000000000001)” so fast in Python 3?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
Given an email address is it possible to determine what the smtp address is using python. I am building an email application using python smtplib.
Thanks
python dns smtp smtplib mx-record
add a comment |
Given an email address is it possible to determine what the smtp address is using python. I am building an email application using python smtplib.
Thanks
python dns smtp smtplib mx-record
add a comment |
Given an email address is it possible to determine what the smtp address is using python. I am building an email application using python smtplib.
Thanks
python dns smtp smtplib mx-record
Given an email address is it possible to determine what the smtp address is using python. I am building an email application using python smtplib.
Thanks
python dns smtp smtplib mx-record
python dns smtp smtplib mx-record
edited Mar 26 at 9:03
Florian Weimer
19k3 gold badges12 silver badges49 bronze badges
19k3 gold badges12 silver badges49 bronze badges
asked Mar 25 at 20:26
the_big_blackboxthe_big_blackbox
3537 silver badges21 bronze badges
3537 silver badges21 bronze badges
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
The Python smtplib
module does not perform mail routing, so it leaves that to a smart host.
You could use dnspython
to look up MX records for the destination domain (and A and AAAA records if there is no MX record). The resulting address you can then pass to smtplib
.
However, this is only a small fraction of the work that is needed to implement proper mail routing: If the target mail server is unreachable or times out, you are supposed to try the next server. Similarly if it responds with a 4xx
error code. If all servers are unavailable, you need to temporarily store the message locally, so you need to implement your own mail queue. Furthermore, your external IP address may be blacklisted for mail delivery.
Therefore, it is usually easier to install a local mail server such as Exim or Postfix and use that to inject mail, possibly routing it via a smart host with good email reputation to avoid blacklisting.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55345895%2fdetermine-smtp-server-for-a-given-email-address-python-smtplib%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The Python smtplib
module does not perform mail routing, so it leaves that to a smart host.
You could use dnspython
to look up MX records for the destination domain (and A and AAAA records if there is no MX record). The resulting address you can then pass to smtplib
.
However, this is only a small fraction of the work that is needed to implement proper mail routing: If the target mail server is unreachable or times out, you are supposed to try the next server. Similarly if it responds with a 4xx
error code. If all servers are unavailable, you need to temporarily store the message locally, so you need to implement your own mail queue. Furthermore, your external IP address may be blacklisted for mail delivery.
Therefore, it is usually easier to install a local mail server such as Exim or Postfix and use that to inject mail, possibly routing it via a smart host with good email reputation to avoid blacklisting.
add a comment |
The Python smtplib
module does not perform mail routing, so it leaves that to a smart host.
You could use dnspython
to look up MX records for the destination domain (and A and AAAA records if there is no MX record). The resulting address you can then pass to smtplib
.
However, this is only a small fraction of the work that is needed to implement proper mail routing: If the target mail server is unreachable or times out, you are supposed to try the next server. Similarly if it responds with a 4xx
error code. If all servers are unavailable, you need to temporarily store the message locally, so you need to implement your own mail queue. Furthermore, your external IP address may be blacklisted for mail delivery.
Therefore, it is usually easier to install a local mail server such as Exim or Postfix and use that to inject mail, possibly routing it via a smart host with good email reputation to avoid blacklisting.
add a comment |
The Python smtplib
module does not perform mail routing, so it leaves that to a smart host.
You could use dnspython
to look up MX records for the destination domain (and A and AAAA records if there is no MX record). The resulting address you can then pass to smtplib
.
However, this is only a small fraction of the work that is needed to implement proper mail routing: If the target mail server is unreachable or times out, you are supposed to try the next server. Similarly if it responds with a 4xx
error code. If all servers are unavailable, you need to temporarily store the message locally, so you need to implement your own mail queue. Furthermore, your external IP address may be blacklisted for mail delivery.
Therefore, it is usually easier to install a local mail server such as Exim or Postfix and use that to inject mail, possibly routing it via a smart host with good email reputation to avoid blacklisting.
The Python smtplib
module does not perform mail routing, so it leaves that to a smart host.
You could use dnspython
to look up MX records for the destination domain (and A and AAAA records if there is no MX record). The resulting address you can then pass to smtplib
.
However, this is only a small fraction of the work that is needed to implement proper mail routing: If the target mail server is unreachable or times out, you are supposed to try the next server. Similarly if it responds with a 4xx
error code. If all servers are unavailable, you need to temporarily store the message locally, so you need to implement your own mail queue. Furthermore, your external IP address may be blacklisted for mail delivery.
Therefore, it is usually easier to install a local mail server such as Exim or Postfix and use that to inject mail, possibly routing it via a smart host with good email reputation to avoid blacklisting.
answered Mar 26 at 9:07
Florian WeimerFlorian Weimer
19k3 gold badges12 silver badges49 bronze badges
19k3 gold badges12 silver badges49 bronze badges
add a comment |
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55345895%2fdetermine-smtp-server-for-a-given-email-address-python-smtplib%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown