Ejemplo n.º 1
0
 def sendConfirmationEmail(self, request=None):
     """
     If propsheet prefs are set appropriately, sends an email to the registant
     confirming their registration, and to the event's registry contact with
     registrant's details.
     """
     propsheet = getPropSheet(self)
     if propsheet.confirm_to_registrant:
         self.confirmToRegistrant(request)
     if propsheet.confirm_to_registry_contact:
         self.confirmToRegistryContact(request)
Ejemplo n.º 2
0
    def confirmToRegistryContact(self, request):
        '''
        Sends a confirmation email designated registry address
        '''
        portal = getToolByName(self, 'portal_url').getPortalObject()
        event = self.aq_inner.aq_parent
        propsheet = getPropSheet(self)

        # Compose the message
        from_adress = propsheet.from_address
        if not from_adress:
            from_adress = portal.email_from_address
        mailfrom = email.Utils.formataddr((propsheet.from_name, from_adress))
        fullname = self.first_name + ' ' + self.last_name
        registry_contact = event.registry_contact
        if not registry_contact:
            registry_contact = propsheet.default_registry_contact
        mailto = email.Utils.formataddr(("Events Registry", registry_contact))
        subject = 'Registration :: ' + fullname + ' :: ' + event.title
        body = ''
        body += 'First Name:     %s\n' % self.first_name
        body += 'Last Name:      %s\n' % self.last_name
        body += 'Company:        %s\n' % self.company
        body += 'Job Title:      %s\n' % self.job_title
        body += 'Email Address:  %s\n' % self.email
        body += 'Phone:          %s\n' % self.phone
        body += 'Address:        %s\n' % self.street
        body += 'City:           %s\n' % self.city
        body += 'State:          %s\n' % self.state
        body += 'Zip:            %s\n' % self.zip
        body += 'Website:        %s\n' % self.website
        body += 'Comments:       %s\n' % self.comments
        body += '\n'
        message = MIMEText(body)
        message['To'] = mailto
        message['From'] = mailfrom
        message['Subject'] = subject
        # Send the message
        portal.MailHost.send(message.as_string())
Ejemplo n.º 3
0
 def confirmToRegistrant(self, request):
     '''
     Sends a confirmation email to the registrant
     '''
     portal = getToolByName(self, 'portal_url').getPortalObject()
     event = self.aq_inner.aq_parent
     email_from_address = portal.email_from_address
     propsheet = getPropSheet(self)
     start_string = event.startDate.strftime(
         propsheet.long_day_format)  # Start day (nicely formatted)
     if not event.ignore_hours:
         start_string += ', ' + event.startDate.strftime(
             propsheet.hour_format)
     # these are the vars that can be accessed using %(varname)s in propsheet.message_to_registrant
     messagevars = {
         'first_name': self.first_name,
         'last_name': self.last_name,
         'event_title': event.title,  # Event title
         'event_page': event.absolute_url(),  # URL for event's webpage
         'event_summary': event.Description,
         'event_start': start_string,
         'website_title': portal.title,  # title of the whole website
         'website_url': portal.absolute_url(),  # URL for the website
     }
     # Compose the message
     mailfrom = email.Utils.formataddr((propsheet.from_name,
                                        getattr(propsheet, 'from_address',
                                                email_from_address)))
     mailto = email.Utils.formataddr(
         (self.getFirst_name() + ' ' + self.getLast_name(),
          self.getEmail()))
     subject = 'Registration confirmation for "' + event.title + '".'
     body = self.confirmation_email_body() % messagevars
     message = MIMEText(body)
     message['To'] = mailto
     message['From'] = mailfrom
     message['Subject'] = subject
     # Send the message
     portal.MailHost.send(message.as_string())
 def getDefaultRegistryContact(self):
     return getPropSheet(self).default_registry_contact
 def getDefaultMessageToRegistrant(self):
     return '\n'.join(getPropSheet(self).message_to_registrant)
 def hourFormat(self):
     return getPropSheet(self).hour_format
 def longDayFormat(self):
     return getPropSheet(self).long_day_format
 def shortDayFormat(self):
     return getPropSheet(self).short_day_format
 def getDefaultRegistryContact(self):
     return getPropSheet(self).default_registry_contact
 def getDefaultMessageToRegistrant(self):
     return '\n'.join(getPropSheet(self).message_to_registrant)
 def hourFormat(self):
     return getPropSheet(self).hour_format
 def longDayFormat(self):
     return getPropSheet(self).long_day_format
 def shortDayFormat(self):
     return getPropSheet(self).short_day_format