sfMail
index
/home/sfscript/src/py_sforce/sflib/sfMail.py

Copyright 2004 Chip Vanek, Magma Design Automation
 
   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at
 
       http://www.apache.org/licenses/LICENSE-2.0
 
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
 
    Chip Vanek (chip@upvia.com), Nov 1st, 2004
 
Library to support email messaging

 
Modules
       
cStringIO
sets
types

 
Classes
       
MailServer
Message

 
class MailServer
    This class contains the methods necessary for sending an email message and
checking the message's delivery status to various recipients.
 
  Methods defined here:
__init__(self, smtpServer=None, logger=None)
getSendResults(self, message, emailResults)
generic mail sending results printing
accepts Message object and results structure
sendEmail(self, message, trial=False)
actually send the email message.
 
message - Message object
trial - if set to True, doesn't actually send email. Default: False

Data and other attributes defined here:
debug = 1
notifyList = []

 
class Message
    Represents an email message for sending.
 
Creates full text implementation on initialization as well as storing
all fields as member variables.
 
fromAdd - single address of message sender
toAdds - single address or list of addresses of primary recipients
body - Text of message body as string
subject - optional subject string
ccAdds - optional single address or list of addresses of copy recipients
bccAdds - optional single address or list of addresses of
          blindcopy recipients
 
  Methods defined here:
__init__(self, fromAdd, toAdds, body, subject='', ccAdds=None, bccAdds=None)
__repr__(self)
__str__(self)
buildMsg(self)
Builds and stores message text based on the member components.
Call this if any of the data (recipients, subject, body) has changed
after the object has been instantiated.
stringOrIterable(self, value)
if value is not a list or tuple, packs value as one item list
before returning it

 
Functions
       
getAliasString(emailList)
Function to extract and return a list (String, comma separated)
of Mamga aliases from provided email list

 
Data
        ACCOUNT_OBJ = 'Account'
ACCOUNT_SIG = '001'
BAD_INFO_LIST = [None, [], [{}], {}, '', 'fail', 'warn']
BRANCH_CR_LINK_OBJ = 'Branch_CR_Link__c'
CASE_OBJ = 'Case'
CASE_SIG = '500'
CONTACT_OBJ = 'Contact'
CONTACT_SIG = '003'
LEAD_OBJ = 'Lead'
LEAD_OWNER_SIG = ['005', '00G']
LEAD_SIG = '00Q'
NOTE_OBJ = 'Note'
NOTE_SIG = '002'
QUEUE_OBJ = 'Queue'
QUEUE_SIG = '00G'
RECTYPE_CR = '01230000000001YAAQ'
RECTYPE_PVCR = '0123000000003qfAAA'
TASK_BRANCH_OBJ = 'Task_Branch__c'
TEAM_BRANCH_OBJ = 'Team_Branch__c'
USER_OBJ = 'User'
USER_SIG = '005'