public function sendTickets()
    {
        // Get the mail sender or fallback to the admin email
        if (($from = self::config()->get('mail_sender')) && empty($from)) {
            $from = Config::inst()->get('Email', 'admin_email');
        }

        // Send the tickets to the main contact
        $email = new Email();
        $email->setSubject(_t(
            'MainContactMail.TITLE',
            'Uw tickets voor {event}',
            null,
            array(
                'event' => $this->Event()->Title
            )
        ));
        $email->setFrom($from);
        $email->setTo($this->MainContact()->Email);
        $email->setTemplate('MainContactMail');
        $email->populateTemplate($this);
        $this->extend('updateMainContactMail', $email);
        $sent = $email->send();


        // Get the attendees for this event that are checked as receiver
        $ticketReceivers = $this->Attendees()->filter('TicketReceiver', 1)->exclude('ID', $this->MainContactID);
        if ($ticketReceivers->exists()) {
            /** @var Attendee $ticketReceiver */
            foreach ($ticketReceivers as $ticketReceiver) {
                $sentAttendee = $ticketReceiver->sendTicket();
                if ($sent && !$sentAttendee) {
                    $sent = $sentAttendee;
                }
            }
        }

        return $sent;
    }
public function sendTickets()
    {
        // Get the mail sender or fallback to the admin email
        if (($from = self::config()->get('mail_sender')) && empty($from)) {
            $from = Config::inst()->get('Email', 'admin_email');
        }

        // Send the tickets to the main contact
        $email = new Email();
        $email->setSubject(_t(
            'MainContactMail.TITLE',
            'Uw tickets voor {event}',
            null,
            array(
                'event' => $this->Event()->Title
            )
        ));
        $email->setFrom($from);
        $email->setTo($this->MainContact()->Email);
        $email->setTemplate('MainContactMail');
        $email->populateTemplate($this);
        $this->extend('updateMainContactMail', $email);
        $sent = $email->send();


        // Get the attendees for this event that are checked as receiver
        $ticketReceivers = $this->Attendees()->filter('TicketReceiver', 1)->exclude('ID', $this->MainContactID);
        if ($ticketReceivers->exists()) {
            /** @var Attendee $ticketReceiver */
            foreach ($ticketReceivers as $ticketReceiver) {
                $sentAttendee = $ticketReceiver->sendTicket();
                if ($sent && !$sentAttendee) {
                    $sent = $sentAttendee;
                }
            }
        }

        return $sent;
    }
public function sendTickets ( ) { // Get the mail sender or fallback to the admin email if ( ( $ from = self :: config ( ) -> get ( 'mail_sender' ) ) && empty ( $ from ) ) { $ from = Config :: inst ( ) -> get ( 'Email' , 'admin_email' ) ; } // Send the tickets to the main contact $ email = new Email ( ) ; $ email -> setSubject ( _t ( 'MainContactMail.TITLE' , 'Uw tickets voor {event}' , null , array ( 'event' => $ this -> Event ( ) -> Title ) ) ) ; $ email -> setFrom ( $ from ) ; $ email -> setTo ( $ this -> MainContact ( ) -> Email ) ; $ email -> setTemplate ( 'MainContactMail' ) ; $ email -> populateTemplate ( $ this ) ; $ this -> extend ( 'updateMainContactMail' , $ email ) ; $ sent = $ email -> send ( ) ; // Get the attendees for this event that are checked as receiver $ ticketReceivers = $ this -> Attendees ( ) -> filter ( 'TicketReceiver' , 1 ) -> exclude ( 'ID' , $ this -> MainContactID ) ; if ( $ ticketReceivers -> exists ( ) ) { /** @var Attendee $ticketReceiver */ foreach ( $ ticketReceivers as $ ticketReceiver ) { $ sentAttendee = $ ticketReceiver -> sendTicket ( ) ; if ( $ sent && ! $ sentAttendee ) { $ sent = $ sentAttendee ; } } } return $ sent ; }
Send the reserved tickets

@return mixed
Send the reserved tickets