Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #103781
| From | Anthony Papillion <anthony@cajuntechie.org> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: Sending an email with a binary attachment |
| Date | 2016-03-01 01:58 -0600 |
| Message-ID | <mailman.58.1456818869.20602.python-list@python.org> (permalink) |
| References | <mailman.0.1456733421.20602.python-list@python.org> <djjc8gFl1hoU1@mid.individual.net> <CAPTjJmq-Qj9UEg0MNfAWo0CivMcO449=gSA913p4=sN+dp9V8A@mail.gmail.com> |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 On 02/29/2016 11:13 AM, Chris Angelico wrote: > 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()) Hmm, I'm a bit confused. Are you saying that the problem is that I'm enclosing the code in a Try/Except block? Besides that, I don't see anything different. If it's the Try/Except block, how do I catch the exception it might generate if I'm not using the exception block? Thanks, Anthony -----BEGIN PGP SIGNATURE----- iQIbBAEBCgAGBQJW1UuZAAoJEAKK33RTsEsVdfoP+N/xBIMouhhS1pqInvd9wrk2 jCfjmk7aHQQOdSvtQjXEqdNUu6nPmvX9VRzqvs881bUZAx31usL7VnyzJsL89pZl PPrXG3WzEDkMaWmfZ45/irGwuP3Cpwkw3h7raDcvA/kV7+jLUBq//1kW7itofPh8 6xKJ9yCJ35vCS4LDhEeIbtMQXRe27QQXeFfi2VjFFRQRQeJlKf0nAd8sH/4q1fPa IVKy6lgZcDDzCzy0Ux9us8baUOgTjLIY81AKMXGUmXaUNLpDfF6n6RLRtj8fLcN5 sT37okHyRmK9LNwI1PzU8r2p7i3gweDXx4x9g6nqmi6OV8fm4suSd8VOWb8oF1Yb clQWSvSPE3GcnVaepcixIV1PCF53KsCHaPp63RZbKB3MiPuNTdQQi9Xm1Qfrt0UW uJiEzfGXavkNRYaShycMB6HJGfjIsCZH9wzf1/irCuhiy+kJbvQq9lhojWw/V0N3 TGwY0Sd/eWqtmcx+u449viDIfLZsJDjzXXsYV60JdZtsSsd5+Mud+vfOlv3s/oy0 EPnIzMJar5LGPghPuab8g7rcXim77hFxS7eLp4j9ugWgRPa8TRpiBb/wx2c8a2e0 122ZW8Fc7+9gxHxSCJdM7GIFChdN2IMogCkERAuTyo+dNP01Mv07eMvSA6JkgiN2 ZlSJ8M9UHRS7dplpJGE= =nxc8 -----END PGP SIGNATURE-----
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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