Path: csiph.com!usenet.pasdenom.info!news.albasani.net!news.stack.nl!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.145 X-Spam-Level: * X-Spam-Evidence: '*H*': 0.71; '*S*': 0.00; 'intermediate': 0.07; 'cc:addr:python-list': 0.11; 'python': 0.11; 'question.': 0.14; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'sat,': 0.16; 'wrote:': 0.18; 'server,': 0.19; 'not,': 0.20; 'cc:addr:python.org': 0.22; 'install': 0.23; 'server.': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'record': 0.27; 'external': 0.29; 'am,': 0.29; "doesn't": 0.30; 'dec': 0.30; 'message-id:@mail.gmail.com': 0.30; 'use?': 0.31; 'another': 0.32; 'announce': 0.33; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; '14,': 0.36; 'in.': 0.36; 'installing': 0.36; 'smtp': 0.36; 'next': 0.36; 'shows': 0.36; 'wrong': 0.37; 'being': 0.38; 'sometimes': 0.38; 'server': 0.38; 'that,': 0.38; 'ability': 0.39; 'does': 0.39; 'legitimate': 0.39; 'deliver': 0.61; "you're": 0.61; 'address': 0.63; 'name': 0.63; 'skip:n 10': 0.64; 'pick': 0.64; 'spam.': 0.64; 'yourself': 0.78; 'domain?': 0.84; 'forced': 0.84; 'presumably': 0.84; 'subject:Using': 0.84; 'to:none': 0.92; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=u+Fn9I9/nGsltlXOwLKSeCNBbGwPQjPZL7awODrVM+I=; b=vjNptMdnQUoNW0tl5uZpHIA4sZmRebDQuwiNu9Fr8aWON/032Zfu8wftENPHj49/hX BryJVJWqWEIX7wXHtkmjfn5VA350h375vZxKDIPKwo5WHBnIlYvvxSAAjLrqm7TTehLc IjtaRzsmKVFV9nUzJqEOeoJaQRVG/n2ooXwjzXp3Z0glTy813pV6MNlNpfA8nUh9RqNk Q+jWvqZe/igs0aHr7A4nlvFQBSX2qkr+W+53eeQBTA7/OCis85u8HAmY+32KfY9ForaK 9+DglQxFT9TuUoXu0fvW/+B8UU690oAmD2OIQ7+mM6Lr8dWF70Y03vqPkTtqMYeXiVxl SBHw== MIME-Version: 1.0 X-Received: by 10.66.65.134 with SMTP id x6mr4925864pas.142.1386958555757; Fri, 13 Dec 2013 10:15:55 -0800 (PST) In-Reply-To: References: Date: Sat, 14 Dec 2013 05:15:55 +1100 Subject: Re: Using pythons smtp server From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 29 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1386958559 news.xs4all.nl 2860 [2001:888:2000:d::a6]:44257 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:61857 On Sat, Dec 14, 2013 at 4:13 AM, Vincent Davis wrote: > Let me rephrase my question. I want to send an email using python but do not > want to use an external service. Does python have the ability to send emails > without installing additional software or using an external server/service? Any SMTP server you install has to do one of three things with the mail you give it: 1) Accept it locally. Presumably the wrong thing to do here. 2) Deliver it to the authoritative SMTP server for the domain. 3) Deliver it to an intermediate server. (Edit: Your next mail shows that you understand that, as looking up the MX record is what I was going to say here.) So if you want to avoid using an external intermediate server, you need to find and talk to the authoritative server. Now, this is where another big consideration comes in. What envelope From address are you going to use? Is your own IP address allowed to send mail for that domain? If not, you may be forced to use the legitimate server for that domain. There are other concerns, too; if you don't have a nice name to announce in the HELO, you might find your mail treated as spam. But if you deal with all that, then yes, the only thing you need to do is look up the MX record and pick the best server. (And then deal with other concerns like coping with that one being down, which is the advantage of having a local mail queue. But sometimes that doesn't matter, like if you're sending to yourself for notifications.) ChrisA