[Zope] MailHost and Bcc

Peter Bengtsson peter at fry-it.com
Wed Jul 11 12:43:24 EDT 2007


I doubt that the MailHost supports bcc with the send() function.
I for one don't use the MailHost's send() function. I just use it's 
_send() function for the actual sending and I create the email message 
manually using the email package in python. But that's a whole different 
story.

If you look up the Secure MailHost product I think it has a function 
called secureSend() or something which I think has a bcc parameter that 
you might find useful.

Catherine E. Reinehr wrote:
> Good morning!
> 
> My web site utilizes forms pretty extensively, and I've been trying to
> figure out how--on one particular form, an admission application--to bcc all
> copies to another address.  Depending on which campus the applicant chooses,
> the app is emailed to a different person; the program director wants to
> receive ALL the apps, without the other recipients knowing.  But I just
> can't seem to make it work.  Of course, that might have something to do with
> the fact that I'm not a programmer, which is why I'm asking for help.  Any
> suggestions would be greatly appreciated!  The coding looks like this:
> 
> # Example code:
> 
> # Import a standard function, and get the HTML request and response objects.
> from Products.PythonScripts.standard import html_quote
> request = container.REQUEST
> RESPONSE =  request.RESPONSE
> 
> try:
>     mailhost=getattr(context, context.superValues('Mail Host')[0].id)
> except:
>     raise AttributeError, "cant find a Mail Host object"
> 
> contacts = {
>     'Bay Minette': 'email1 at huntingdon.edu',
>     'Center Point': 'email2 at huntingdon.edu',
>     'Pell City': 'email2 at huntingdon.edu',
>     'Shelby': 'email2 at huntingdon.edu',
>     'Enterprise': 'email3 at huntingdon.edu',
>     'Daphne': 'email1 at huntingdon.edu',
>     'Montgomery': 'email4 at huntingdon.edu'
> }
> 
> if request.has_key('campus'):
>     mTo = contacts[request['campus']]
> else:
>     mTo = 'School of Business and Professional Studies
> <email at huntingdon.edu>'
> 
> mFrom = 'School of Business and Professional Studies <email at huntingdon.edu>'
> 
> if request.has_key('email') and request.has_key('first_name') and
> request.has_key('last_name'):
>     if request['email'] != '' and request['first_name'] != '' and
> request['last_name'] != '':
>       mFrom = "%s %s <%s>" % (request['first_name'], request['last_name'],
> request['email'])
> 
> mSubj = 'SBPS Application'
> print " Application Information"
> print "-------------------------------------------------"
> print " Term:\t\t", request['term']
> print " Campus:\t", request['campus']
> print "  Name:\t\t", request['prefix'], request['first_name'],
> request['middle_name'], request['last_name']
> print "  Preferred Name:\t\t", request['preferred_name']
> print "  Maiden Name:\t\t", request['maiden_name']
> print "  DOB:\t\t%s/%s/%s" % (request['dob_month'], request['dob_day'],
> request['dob_year'])
> 
> print "  Address:\t\t", request['address']
> if request.has_key('address_2'):
>     if request['address_2'] != '':
>         print "\t\t\t", request['address_2']
> 
> print "  City:\t\t", request['city']
> print "  State:\t\t", request['state']
> print "  Zip Code:\t\t", request['zip']
> print "  Email:\t\t", request['email']
> print "  Home Phone:\t", request['phone_home']
> print "  Work Phone:\t", request['phone_work']
> print "  Cell Phone:\t", request['phone_cell']
> print ""
> if request.has_key('citizenship'):
>     if request['citizenship'] == 'U.S.':
>         print "  Citizenship:\t\t", request['citizenship']
> 
>     else:
>         print "  Citizenship:\t\t", request['citizenship_other']
> 
> print "  Marital Status:\t", request['optional_martial_status']
> print "  Ethnic Origin:\t", request['optional_ethnicity']
> print "  Religion:\t", request['optional_religion']
> 
> if request.has_key('work_experience'): print '  Work Experience:\t',
> request['work_experience']
> if request.has_key('financial_aid'): print '  Financial Aid:\t\t',
> request['financial_aid']
> if request.has_key('veteran'): print '  Veteran\'s Benefits:\t',
> request['veteran']
> print ""
> 
> print 'Academic Information'
> print '  High School:\t', request['high_school']
> print '  City:\t\t', request['high_school_city']
> print '  State:\t\t', request['high_school_state']
> print '  Graduated:\t', request['high_school_graduated']
> print ''
> 
> if request.has_key('school_name') and request.has_key('school_city') and
> request.has_key('school_state') and request.has_key('school_credits'):
>     schools = [school for school in request['school_name'] if school != '']
>     i = 0
> 
>     print "Other schools attended:"
>     print "-----------------------"
> 
>     for school in schools:
>       print "  School:\t", school
>       print "  City:\t", request['school_city'][i]
>       print "  State:\t", request['school_state'][i]
>       print "  Credits:\t", request['school_credits'][i]
>       print ""
> 
>       i = i + 1
> 
> print "Applicable Military Training:"
> 
> if request.has_key('military_training'):
>     if request['military_training'] != '':
>         print request['military_training']
> 
>     else: print 'None'
> 
> print 'Source:'
> print request['source']
> print ""
> 
> #print request
> #return printed
> 
> try:
>   mailhost.send(printed, mTo, mFrom, mSubj)
>   request.RESPONSE.redirect('/sbps/application_success')
> 
> except:
>   request.RESPONSE.redirect('/sbps/application_error')
> 
> #return printed
> 
> -----
> 
> Catherine E. Reinehr
> Webmaster & Publications Designer
> Huntingdon College
> 1500 E. Fairview Ave.
> Montgomery, AL 36106
> (334) 833-4429 / Flowers 207
> 
> 
> 
> _______________________________________________
> Zope maillist  -  Zope at zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )
> 

-- 
Peter Bengtsson,
work www.fry-it.com
home www.peterbe.com
hobby www.issuetrackerproduct.com


More information about the Zope mailing list