Model/Customer/Guest.php
public function exportGuestPerWebsite($website)
    {
        $onlySubscribers = $this->helper->isOnlySubscribersForContactSync($website->getWebsiteId());
        $contact = $this->contactFactory->create();
        $guests = ($onlySubscribers) ? $contact->getGuests($website, true) :
            $contact->getGuests($website);

        //found some guests
        if ($guests->getSize()) {
            $guestFilename = strtolower(
                $website->getCode() . '_guest_'
                . date('d_m_Y_His') . '.csv'
            );
            $this->helper->log('Guest file: ' . $guestFilename);
            $storeName = $this->helper->getMappedStoreName($website);
            $this->file->outputCSV(
                $this->file->getFilePath($guestFilename),
                ['Email', 'emailType', $storeName]
            );

            foreach ($guests as $guest) {
                $this->outputCsvToFile($guest, $website, $guestFilename);
            }
            if ($this->countGuests) {
                //register in queue with importer
                $this->importerFactory->create()
                    ->registerQueue(
                        \Dotdigitalgroup\Email\Model\Importer::IMPORT_TYPE_GUEST,
                        '',
                        \Dotdigitalgroup\Email\Model\Importer::MODE_BULK,
                        $website->getId(),
                        $guestFilename
                    );
            }
        }
    }
public function exportGuestPerWebsite($website)
    {
        $onlySubscribers = $this->helper->isOnlySubscribersForContactSync($website->getWebsiteId());
        $contact = $this->contactFactory->create();
        $guests = ($onlySubscribers) ? $contact->getGuests($website, true) :
            $contact->getGuests($website);

        //found some guests
        if ($guests->getSize()) {
            $guestFilename = strtolower(
                $website->getCode() . '_guest_'
                . date('d_m_Y_His') . '.csv'
            );
            $this->helper->log('Guest file: ' . $guestFilename);
            $storeName = $this->helper->getMappedStoreName($website);
            $this->file->outputCSV(
                $this->file->getFilePath($guestFilename),
                ['Email', 'emailType', $storeName]
            );

            foreach ($guests as $guest) {
                $this->outputCsvToFile($guest, $website, $guestFilename);
            }
            if ($this->countGuests) {
                //register in queue with importer
                $this->importerFactory->create()
                    ->registerQueue(
                        \Dotdigitalgroup\Email\Model\Importer::IMPORT_TYPE_GUEST,
                        '',
                        \Dotdigitalgroup\Email\Model\Importer::MODE_BULK,
                        $website->getId(),
                        $guestFilename
                    );
            }
        }
    }
public function exportGuestPerWebsite ( $ website ) { $ onlySubscribers = $ this -> helper -> isOnlySubscribersForContactSync ( $ website -> getWebsiteId ( ) ) ; $ contact = $ this -> contactFactory -> create ( ) ; $ guests = ( $ onlySubscribers ) ? $ contact -> getGuests ( $ website , true ) : $ contact -> getGuests ( $ website ) ; //found some guests if ( $ guests -> getSize ( ) ) { $ guestFilename = strtolower ( $ website -> getCode ( ) . '_guest_' . date ( 'd_m_Y_His' ) . '.csv' ) ; $ this -> helper -> log ( 'Guest file: ' . $ guestFilename ) ; $ storeName = $ this -> helper -> getMappedStoreName ( $ website ) ; $ this -> file -> outputCSV ( $ this -> file -> getFilePath ( $ guestFilename ) , [ 'Email' , 'emailType' , $ storeName ] ) ; foreach ( $ guests as $ guest ) { $ this -> outputCsvToFile ( $ guest , $ website , $ guestFilename ) ; } if ( $ this -> countGuests ) { //register in queue with importer $ this -> importerFactory -> create ( ) -> registerQueue ( \ Dotdigitalgroup \ Email \ Model \ Importer :: IMPORT_TYPE_GUEST , '' , \ Dotdigitalgroup \ Email \ Model \ Importer :: MODE_BULK , $ website -> getId ( ) , $ guestFilename ) ; } } }
Export guests for a website.

@param \Magento\Store\Model\Website $website

@return null
@throws \Magento\Framework\Exception\LocalizedException
Export guests for a website .