Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #103737

Re: Sending an email with a binary attachment

From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Subject Re: Sending an email with a binary attachment
Date 2016-03-01 04:13 +1100
Message-ID <mailman.27.1456766046.20602.python-list@python.org> (permalink)
References <mailman.0.1456733421.20602.python-list@python.org> <djjc8gFl1hoU1@mid.individual.net>

Show all headers | View raw


On Tue, Mar 1, 2016 at 4:08 AM, Peter Pearson <pkpearson@nowhere.invalid> wrote:
> try:
>     smtp.sendmail(message['From'],
>             message['To'],
>             message.as_string())
> except:
>     print "Message sending has failed"
>     sys.exit(1)
> print "Message sending was successful"
> sys.exit(0)
>

This is the problem, right here. Replace this code with:

smtp.sendmail(message['From'],
            message['To'],
            message.as_string())

ChrisA

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Sending an email with a binary attachment Anthony Papillion <anthony@cajuntechie.org> - 2016-02-29 02:10 -0600
  Re: Sending an email with a binary attachment Peter Pearson <pkpearson@nowhere.invalid> - 2016-02-29 17:08 +0000
    Re: Sending an email with a binary attachment Chris Angelico <rosuav@gmail.com> - 2016-03-01 04:13 +1100
    Re: Sending an email with a binary attachment Grant Edwards <invalid@invalid.invalid> - 2016-02-29 18:22 +0000
    Re: Sending an email with a binary attachment Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2016-02-29 20:43 -0500
    Re: Sending an email with a binary attachment Anthony Papillion <anthony@cajuntechie.org> - 2016-03-01 01:58 -0600
    Re: Sending an email with a binary attachment Chris Angelico <rosuav@gmail.com> - 2016-03-01 19:03 +1100
    Re: Sending an email with a binary attachment Anthony Papillion <anthony@cajuntechie.org> - 2016-03-01 22:29 -0600

csiph-web