Possible to email to multiple addresses

26 views
Skip to first unread message

BikeMike

unread,
Aug 30, 2010, 7:06:16 PM8/30/10
to Bots Open Source EDI Translator
Sorry I could not post to the original topic.
http://groups.google.com/group/botsmail/browse_thread/thread/beee86fb1822b541/9dfdb07c35ce7197

I had a need to do this again so I took another look at it.
You can use To and CC if you need 2 addresses, but I needed 3.

In communication.py line 609 (version 2.0.1) I changed...
addresslist = [x for x in (row['tomail'],row['cc']) if x]
to
addresslist = row['tomail'].split(',') + row['cc'].split(',')

This allows the email address fields to contain multiple comma
separated values. The validation on these fields allows this for the
To: but not for the CC: address, which is being validated as a single
email address.

I found some code for validating multiple emails, tried putting it in
models.py with a few changes, but couldn't get it to display the red
error messages (I get a webserver error when invalid emails entered).
http://djangosnippets.org/snippets/1464/

So it's working for me but would be nice to have the field validation
working too :-)

Kind regards,
Mike

Jean-François

unread,
Dec 31, 2011, 6:19:12 AM12/31/11
to BikeMike, bots...@googlegroups.com
Thanks Mike, this is very helpful as I also needed this feature.
Would it be integrated in future Bots versions?

I wish all Bots contributors (a special thanks to Henk-Jan, of course)
a very happy 2012 :-)

JF

On Aug 31 2010, 12:06 am, BikeMike <mjg1...@gmail.com> wrote:
> Sorry I could not post to the original topic.http://groups.google.com/group/botsmail/browse_thread/thread/beee86fb...


>
> I had a need to do this again so I took another look at it.

> You can use To andCCif you need 2 addresses, but I needed 3.


>
> In communication.py line 609 (version 2.0.1) I changed...
>     addresslist = [x for x in (row['tomail'],row['cc']) if x]
> to
>     addresslist = row['tomail'].split(',') + row['cc'].split(',')
>
> This allows the email address fields to contain multiple comma
> separated values. The validation on these fields allows this for the

> To: but not for theCC: address, which is being validated as a single


> email address.
>
> I found some code for validating multiple emails, tried putting it in
> models.py with a few changes, but couldn't get it to display the red

> error messages (I get a webserver error when invalid emails entered).http://djangosnippets.org/snippets/1464/

BikeMike

unread,
Jan 12, 2012, 4:07:23 AM1/12/12
to Bots Open Source EDI Translator
Hi JF,
This change has not been put into the latest bots version. I don't
have a need for it anymore so haven't worried about it.

You can only enter multiple addresses on the partner "mail" but not on
the "cc", this is actually a bug and neither should allow it.

In models.py class partner
mail = StripCharField(max_length=256,blank=True) # not
validated!
cc = models.EmailField(max_length=256,blank=True) # validated

So with my fix to addresslist, and changing cc in models.py you can
make this work, but there will be no entry validation of the email
address format.

Kind Regards,
Mike

Jean-François

unread,
Jan 12, 2012, 10:46:54 AM1/12/12
to Bots Open Source EDI Translator
Thanks. I got it working with all addresses in "To" field, it's enough
for me :-)
So far :-))
Reply all
Reply to author
Forward
0 new messages