Python Requires Chilkat v11.0.0+
Python
Inspect blind-copy recipients and prepare a shareable copy
See more Email Object Examples
Keep the addressed Email object for SMTP submission. When exporting a copy to share, clear its Bcc collection before saving. Treat intermediate MIME buffers as private because a renderer can preserve blind-copy details.
Chilkat Python Downloads
import sys
import chilkat2
success = False
# Assumes Chilkat is unlocked. See Global Unlock Sample.
email = chilkat2.Email()
email.From = "Workshop team <events@example.com>"
success = email.AddTo("Alex Rivera","alex@example.net")
if (success != True):
print(email.LastErrorText)
sys.exit()
email.Subject = "Workshop registration"
email.Body = "Your workshop confirmation."
success = email.AddBcc("Archive","archive@example.com")
if (success != True):
print(email.LastErrorText)
sys.exit()
i = 0
while (i < email.NumBcc) :
print("Envelope blind copy: " + email.GetBccAddr(i))
i = i + 1
# Keep the original delivery list intact. Remove blind copies from the export.
rendered = chilkat2.BinData()
success = email.GetMimeBd(rendered)
if (success != True):
print(email.LastErrorText)
sys.exit()
copy = chilkat2.Email()
success = copy.SetFromMimeBd(rendered)
if (success != True):
print(copy.LastErrorText)
sys.exit()
copy.ClearBcc()
success = copy.SaveEml("shareable.eml")
if (success != True):
print(copy.LastErrorText)
sys.exit()
print("Bcc entries in shareable copy: " + str(copy.NumBcc))