Re: Wishlist: com.zms.sendmail should allow for Cc, Bcc

Gregor Hoffleit <[email protected]>
Newsgroups gmane.comp.cms.zms.devel
Message-ID <[email protected]>
Thorsten,

thanks for including this.

How about making send_cc and send_bcc optional parameters? Like this?

--- send_mail	2008-06-19 16:29:15.000000000 +0200
+++ send_mail.NEW   2008-06-19 16:34:26.000000000 +0200
@@ -6,16 +6,16 @@
 from email.Utils import COMMASPACE, formatdate
 from email import Encoders
 
-def send_mail(send_from, send_to, send_cc, send_bcc, subject, text, files=[], server="localhost"):
+def send_mail(send_from, send_to, subject, text, files=[], server="localhost", send_cc=[], send_bcc=[]):
   assert type(send_to)==list
   assert type(send_cc)==list
   assert type(send_bcc)==list
   assert type(files)==list
 
   msg = MIMEMultipart('related')
   msg['From'] = send_from
   msg['To'] = COMMASPACE.join(send_to)
-  msg['Cc'] = COMMASPACE.join(send_cc)
+  if send_cc: msg['Cc'] = COMMASPACE.join(send_cc)
   msg['Date'] = formatdate(localtime=True)
   msg['Subject'] = subject
   msg.preamble = 'This is a multi-part message in MIME format.'


Regards,
    Gregor Hoffleit



* Thorsten Fox <[email protected]> [080617 17:59]:
> sendmail with Cc and Bcc will be included in the next release of ZMS 
> 2.11. Alternatively, I included a copy of the library as XML in 
> the "Files" of this group.
> 
> Regards,
> tf 
> 
> --- In [email protected], Gregor Hoffleit <gregor@...> 
> wrote:
> >
> > I noticed that a com.zms.sendmail package was silently added
> > in ZMS 2.11.0-12_1. I guess it is intended to replace the (somehow
> > depreceated since ancient) dtml-sendmail and MailHost with a modern
> > equivalent.
> > 
> > A feature, though, that I miss in com.zms.sendmail.send_mail, is the
> > optional specification of Cc und Bcc lists.
> > 
> > How about amending the API of com.zms.sendmail.send_mail, so that it
> > includes optional cc and bcc parameters?

-- 
Gregor Hoffleit <[email protected]>
Media Supervision Software Consulting GmbH
Georg-Friedrich-Haendel-Str. 13, 69214 Eppelheim/Heidelberg
Tel: +49 6221 705079-0  /  Fax: +49 6221 705079-80
Amtsgericht Mannheim, HRB 336821, Geschäftsführer Reinhard Kratzke
http://www.mediasupervision.de/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.