Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #34128
| Path | csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.010 |
| X-Spam-Evidence | '*H*': 0.98; '*S*': 0.00; 'error:': 0.05; '"+"': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'server:': 0.09; 'typeerror:': 0.09; '46,': 0.16; 'concatenate': 0.16; 'failed.': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:send': 0.16; 'string': 0.17; '>>>': 0.18; '(not': 0.20; 'skip:" 30': 0.20; '---': 0.26; '(most': 0.27; '(as': 0.27; 'connects': 0.27; 'header:X -Complaints-To:1': 0.28; 'starts': 0.29; "skip:' 10": 0.30; 'fri,': 0.30; 'error': 0.30; 'server.': 0.32; 'file': 0.32; 'running': 0.32; 'traceback': 0.33; 'url:home': 0.33; 'to:addr :python-list': 0.33; 'server': 0.35; 'list': 0.35; 'nov': 0.35; "won't": 0.35; 'add': 0.36; 'received:org': 0.36; 'but': 0.36; 'subject:with': 0.36; 'charset:us-ascii': 0.36; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'notice': 0.39; 'list,': 0.39; 'skip:" 10': 0.40; 'header:Received:5': 0.40; 'address': 0.60; "you've": 0.61; 'side': 0.61; 'identifying': 0.65; 'bcc': 0.84; 'can...': 0.84; 'pardon': 0.84; 'dennis': 0.91; 'received:108': 0.91 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | Dennis Lee Bieber <wlfraed@ix.netcom.com> |
| Subject | Re: send email with bcc |
| Date | Sat, 01 Dec 2012 14:41:20 -0500 |
| Organization | > Bestiaria Support Staff < |
| References | <9fedf732-2a8e-4445-bdce-b88d53f4540c@googlegroups.com> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=us-ascii |
| Content-Transfer-Encoding | 7bit |
| X-Gmane-NNTP-Posting-Host | adsl-108-68-176-8.dsl.klmzmi.sbcglobal.net |
| X-Newsreader | Forte Agent 3.3/32.846 |
| X-No-Archive | YES |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.405.1354390881.29569.python-list@python.org> (permalink) |
| Lines | 58 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1354390881 news.xs4all.nl 6934 [2001:888:2000:d::a6]:49981 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:34128 |
Show key headers only | View raw
On Fri, 30 Nov 2012 12:25:37 -0800 (PST), Ed <akegb3@gmail.com>
declaimed the following in gmane.comp.python.general:
> # Start the server:
> smtp.ehlo()
>
Technically, the server is always running -- this just connects you
(as a CLIENT) to that running server.
> # Send the email
> smtp.sendmail(sender, [to] + bcc, msg.as_string())
I notice that you left OUT the CC addresses.
>
> The above generates the following error:
> Traceback (most recent call last):
> File "/opt/batch/ebtest/example4.py", line 46, in <module>
> smtp.sendmail(sender, [to] + bcc, msg.as_string())
Pardon --- you failed to include the ERROR, you've only supplied the
traceback identifying which line failed.
However, presuming the error is
TypeError: can only concatenate list (not "str") to list
then the solution is obvious... DON'T try to use "+" with a string on
one side and a list on the other...
>>> [to] + [cc] + [bcc]
['ed@domain.gov', 'ed@gmailmail.com', 'ed@domain.net']
But note that this won't work if one of the three is already a list!
>>> bcc = ["ed@domain.net", "someone.else"]
>>> [to] + [cc] + [bcc]
['ed@domain.gov', 'ed@gmailmail.com', ['ed@domain.net', 'someone.else']]
If you ensure that each address block starts as a list, you can...
>>> to = ["ed@domain.gov"]
>>> cc = ["ed@gmailmail.com"]
>>> bcc = ["ed@domain.net", "someone.else"]
>>> add = []
>>> add.extend(to)
>>> add.extend(cc)
>>> add.extend(bcc)
>>> add
['ed@domain.gov', 'ed@gmailmail.com', 'ed@domain.net', 'someone.else']
>>>
--
Wulfraed Dennis Lee Bieber AF6VN
wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
send email with bcc Ed <akegb3@gmail.com> - 2012-11-30 12:25 -0800 Re: send email with bcc Tim Golden <mail@timgolden.me.uk> - 2012-11-30 20:40 +0000 Re: send email with bcc Ervin Hegedüs <airween@gmail.com> - 2012-11-30 22:03 +0100 Re: send email with bcc Ed <akegb3@gmail.com> - 2012-11-30 14:35 -0800 Re: send email with bcc Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-12-01 14:41 -0500
csiph-web