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;








1















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










share|improve this question






























    1















    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










    share|improve this question


























      1












      1








      1








      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










      share|improve this question
















      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






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      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






















          1 Answer
          1






          active

          oldest

          votes


















          1














          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.






          share|improve this answer






















            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
            );



            );













            draft saved

            draft discarded


















            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









            1














            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.






            share|improve this answer



























              1














              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.






              share|improve this answer

























                1












                1








                1







                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.






                share|improve this answer













                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.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Mar 26 at 9:07









                Florian WeimerFlorian Weimer

                19k3 gold badges12 silver badges49 bronze badges




                19k3 gold badges12 silver badges49 bronze badges


















                    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.



















                    draft saved

                    draft discarded
















































                    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.




                    draft saved


                    draft discarded














                    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





















































                    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







                    Popular posts from this blog

                    Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

                    Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

                    Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript