/**
  * Basics parse
  *
  * @return array / boolean
  */
 public function parse()
 {
     // parse set to mailobject
     $set = new ezcMailVariableSet($this->MailboxItem->getRawMailMessageContent());
     try {
         $ezcMailObjectArray = $this->MailParser->parseMail($set);
     } catch (Exception $e) {
         CjwNewsletterLog::writeError('CjwNewsletterMailparser::parse', 'parseMail', 'ezcMailParser->parseMail-failed', array('error-code' => $e->getMessage()));
         return false;
     }
     if (count($ezcMailObjectArray) > 0) {
         $this->EzcMailObject = $ezcMailObjectArray[0];
         // return standard email headers
         $parsedMailInfosArray = $this->getHeaders();
         // return x-cwl- email headers
         $parsedCjwMailHeaderArray = $this->getCjwHeaders();
         // merge header arrays
         $parseArray = array_merge($parsedMailInfosArray, $parsedCjwMailHeaderArray);
         return $parseArray;
     } else {
         return false;
     }
 }
 /**
  * (non-PHPdoc)
  * @see kernel/classes/eZPersistentObject#setAttribute($attr, $val)
  */
 function setAttribute($attr, $value)
 {
     switch ($attr) {
         case 'status':
             switch ($value) {
                 case CjwNewsletterEditionSendItem::STATUS_NEW:
                     $this->setAttribute('created', time());
                     break;
                 case CjwNewsletterEditionSendItem::STATUS_SEND:
                     $this->setAttribute('processed', time());
                     break;
                 case CjwNewsletterEditionSendItem::STATUS_ABORT:
                     $this->setAttribute('processed', time());
                     break;
                 default:
                     break;
             }
             CjwNewsletterLog::writeDebug('set status - CjwNewsletterEditionSendItem::setAttribute', 'send_item', $this->attribute('id'), array('status_old' => $this->attribute('status'), 'status_new' => $value, 'nl_user' => $this->attribute('newsletter_user_id')));
             return eZPersistentObject::setAttribute($attr, $value);
             break;
         default:
             return eZPersistentObject::setAttribute($attr, $value);
     }
 }
 /**
  * remove the current subscription
  * @see kernel/classes/eZPersistentObject#remove($conditions, $extraConditions)
  */
 function remove($conditions = null, $extraConditions = null)
 {
     CjwNewsletterLog::writeNotice('CjwNewsletterSubscription::remove', 'subscription', 'remove', array('nl_user' => $this->attribute('newsletter_user_id'), 'subscription_id' => $this->attribute('id'), 'modifier' => eZUser::currentUserID()));
     foreach ($currentNewsletterSubscriptionObjects as $subscription) {
         $subscription->remove();
     }
     parent::remove($conditions, $extraConditions);
 }
 /**
  * saved parsed infos from ezcMailObject into database
  *
  * @param $parsedResult
  */
 private function saveParsedInfos($parsedResult)
 {
     $this->setAttribute('email_from', $parsedResult['from']);
     $this->setAttribute('email_to', $parsedResult['to']);
     $this->setAttribute('email_subject', $parsedResult['subject']);
     $this->setAttribute('bounce_code', $parsedResult['error_code']);
     //$this->setAttribute( 'final_recipient', $parsedResult[ 'final_recipient' ] );
     $this->setAttribute('email_send_date', $this->convertEmailSendDateToTimestamp($parsedResult['email_send_date']));
     // if x-cjwnl-senditem hash was set in bounce mail than fetch some ez data
     if (isset($parsedResult['x-cjwnl-senditem'])) {
         $sendItemHash = $parsedResult['x-cjwnl-senditem'];
         // try to fetch edition send item object
         $sendItemObject = CjwNewsletterEditionSendItem::fetchByHash($sendItemHash, true);
         if (is_object($sendItemObject)) {
             $newsletterUserId = $sendItemObject->attribute('newsletter_user_id');
             $editionSendId = $sendItemObject->attribute('edition_send_id');
             $editionSendItemId = $sendItemObject->attribute('id');
             $this->setAttribute('newsletter_user_id', $newsletterUserId);
             $this->setAttribute('edition_send_id', $editionSendId);
             $this->setAttribute('edition_send_item_id', $editionSendItemId);
             if ($this->isBounce()) {
                 $sendItemObject->setBounced();
                 $newsletterUser = $sendItemObject->attribute('newsletter_user_object');
                 if (is_object($newsletterUser)) {
                     // bounce nl user
                     $isHardBounce = false;
                     $newsletterUser->setBounced($isHardBounce);
                 }
             }
         }
     } elseif (isset($parsedResult['x-cjwnl-user'])) {
         $newsletterUser = CjwNewsletterUser::fetchByHash($sendItemHash, true);
         if (is_object($sendItemObject)) {
             $newsletterUserId = $newsletterUser->attribute('id');
             $this->setAttribute('newsletter_user_id', $newsletterUserId);
             if ($this->isBounce()) {
                 // bounce nl user
                 $isHardBounce = false;
                 $newsletterUser->setBounced($isHardBounce);
             }
         }
     }
     CjwNewsletterLog::writeDebug('parse_result CjwNewsletterMailboxItem::saveParsedInfos', 'mailbox_item', $this->attribute('id'), $parsedResult);
     // item is parsed
     $this->setAttribute('processed', time());
     $this->store();
 }
                    $createNewSubscription = 1;
                    $newListSubscription = CjwNewsletterSubscription::create($listContentObjectId, $newsletterUserId, $outputFormatArray, CjwNewsletterSubscription::STATUS_APPROVED);
                    $newListSubscription->setAttribute('import_id', $importId);
                    // set new remote_id
                    $newListSubscription->setAttribute('remote_id', 'cjwnl:csvimport:' . CjwNewsletterUtils::generateUniqueMd5Hash($newsletterUserId . $importId));
                    $newListSubscription->store();
                    $subscriptionObject = $newListSubscription;
                    $newSubscriptionStatus = $subscriptionObject->attribute('status');
                }
            }
        }
        $listSubscriptionArray[$rowId] = array('subscription_object' => $subscriptionObject, 'email_ok' => $emailOk, 'user_created' => $createNewUser, 'newsletter_user_id' => $newsletterUserId, 'subscription_created' => $createNewSubscription, 'user_status_old' => $existingUserStatus, 'user_status_new' => $newUserStatus, 'subscription_status_old' => $existingSubscriptionStatus, 'subscription_status_new' => $newSubscriptionStatus);
    }
    // imported timestamp + set count for imported users + subscriptions
    $importObject->setImported();
    CjwNewsletterLog::writeNotice('subscription_list_csvimport', 'import', 'end', array('import_id' => $importObject->attribute('id'), 'current_user' => eZUser::currentUserID()));
    // store result to File
    storeImportResultToFile($importId, $listSubscriptionArray);
}
//}
$viewParameters = array('offset' => 0, 'namefilter' => '');
$userParameters = $Params['UserParameters'];
$viewParameters = array_merge($viewParameters, $userParameters);
$tpl = templateInit();
$tpl->setVariable('view_parameters', $viewParameters);
$tpl->setVariable('list_node', $listNode);
$tpl->setVariable('import_id', $importId);
$tpl->setVariable('import_object', $importObject);
$tpl->setVariable('selected_output_format_array', $selectedOutputFormatArray);
$tpl->setVariable('csv_data_array', $csvDataArray);
$tpl->setVariable('list_subscription_array', $listSubscriptionArray);
Ejemplo n.º 6
0
 /**
  * Write Notice
  *
  * @param string $message
  * @param string $source
  * @param string $category
  * @param array $attributes
  * @return void
  */
 public static function writeNotice($message, $source = 'default', $category = 'default', array $attributes = array())
 {
     $log = CjwNewsletterLog::getInstance();
     $log->source = $source;
     $log->category = $category;
     $log->log($message, ezcLog::NOTICE, $attributes);
 }
Ejemplo n.º 7
0
 /**
  * fetch all active subscriptions with current import id
  * and set status to remove by admin
  * @return array subscriptions => nl_user_id
  */
 public function removeActiveSubscriptionsByAdmin()
 {
     $count = CjwNewsletterSubscription::fetchSubscriptionListByImportIdAndStatusCount($this->attribute('id'), CjwNewsletterSubscription::STATUS_APPROVED);
     CjwNewsletterLog::writeNotice("CjwNewsletterImport::removeActiveSubscriptionsByAdmin", 'import', 'start', array('import_id' => $this->attribute('id'), 'active_subscriptions' => $count, 'current_user' => eZUser::currentUserID()));
     // count active subscriptions for import id
     $removeSubscriptionArray = array();
     $limit = 100;
     $loops = ceil($count / $limit);
     // get active subscriptions partly
     for ($i = 0; $i < $loops; $i++) {
         // get active subscriptions
         $subscriptionObjectList = CjwNewsletterSubscription::fetchSubscriptionListByImportIdAndStatus($this->attribute('id'), CjwNewsletterSubscription::STATUS_APPROVED, $limit);
         foreach ($subscriptionObjectList as $subscription) {
             $subscription->removeByAdmin();
             $removeSubscriptionArray[$subscription->attribute('id')] = $subscription->attribute('newsletter_user_id');
         }
     }
     $count = CjwNewsletterSubscription::fetchSubscriptionListByImportIdAndStatusCount($this->attribute('id'), CjwNewsletterSubscription::STATUS_APPROVED);
     CjwNewsletterLog::writeNotice("CjwNewsletterImport::removeActiveSubscriptionsByAdmin", 'import', 'end', array('import_id' => $this->attribute('id'), 'subscriptions_remove_count' => count($removeSubscriptionArray), 'current_user' => eZUser::currentUserID()));
     return $removeSubscriptionArray;
 }
Ejemplo n.º 8
0
 /**
  * This should be called if a user is bounced or blacklisted
  * all related subscriptions and active senditems will be updated
  *
  * @param $status
  * @return unknown_type
  */
 private function setAllNewsletterUserRelatedItemsToStatus($status)
 {
     $newsletterUserId = $this->attribute('id');
     $updateSubcriptions = false;
     switch ($status) {
         case CjwNewsletterSubscription::STATUS_BOUNCED_SOFT:
         case CjwNewsletterSubscription::STATUS_BOUNCED_HARD:
             $bounceCount = CjwNewsletterEditionSendItem::setAllActiveItemsToStatusAbortAndBouncedByNewsletterUserId($newsletterUserId);
             $updateSubcriptions = true;
             break;
         case CjwNewsletterSubscription::STATUS_BLACKLISTED:
             // update active senditems
             $abortCount = CjwNewsletterEditionSendItem::setAllActiveItemsToStatusAbortByNewsletterUserId($newsletterUserId);
             $updateSubcriptions = true;
             break;
     }
     if ($updateSubcriptions === true) {
         // update active subscriptions
         $activeSubscriptionList = CjwNewsletterSubscription::fetchListNotRemovedOrBlacklistedByNewsletterUserId($newsletterUserId, true);
         foreach ($activeSubscriptionList as $subscription) {
             if ($subscription->attribute('status') == $status) {
                 CjwNewsletterLog::writeDebug('skip - already set this status - CjwNewsletterUser::setAllNewsletterUserRelatedItemsToStatus', 'subscription', 'status', array('status' => $status, 'subscription_id' => $subscription->attribute('id'), 'nl_user' => $newsletterUserId));
             } else {
                 $subscription->setAttribute('status', $status);
                 $subscription->store();
                 /*    CjwNewsletterLog::writeDebug(
                        'set CjwNewsletterUser::setAllNewsletterUserRelatedItemsToStatus',
                       'subscription',
                       'status',
                       array( 'status' => $status,
                       'subscription_id' => $subscription->attribute('id'),
                       'nl_user' => $newsletterUserId ) );
                       */
             }
         }
     }
 }
 *
 * - search all cjwnl_edition_send_items, which are not send
 * - process every cjwnl_edition_send_item separatly
 * - generate the newsletter with personal user data (unsubsribe link, configure link, personalisation ... )
 * - send newsletter via mail + set status to SEND
 * - mutex support (no double execute of cronjobs)->integrate in runcronjobs.php
 *
 * @copyright Copyright (C) 2007-2010 CJW Network - Coolscreen.de, JAC Systeme GmbH, Webmanufaktur. All rights reserved.
 * @license http://ez.no/licenses/gnu_gpl GNU GPL v2
 * @version //autogentag//
 * @package cjw_newsletter
 * @subpackage cronjobs
 * @filesource
 */
// to fetch instance in Cli mode for separate logdata, cause access rights phpcli + webserver
$logInstance = CjwNewsletterLog::getInstance(true);
$message = "START: cjw_newsletter_mailqueue_process";
$cli->output($message);
// to fetch all send objetc with status == STATUS_MALQUEUE_CREATED || STATUS_MALQUEUE_STARTED
$sendObjectList = CjwNewsletterEditionSend::fetchEditionSendListByStatus(array(CjwNewsletterEditionSend::STATUS_MAILQUEUE_CREATED, CjwNewsletterEditionSend::STATUS_MAILQUEUE_PROCESS_STARTED));
// - count all + how much should send?
// - if send = 0 at first element status == STATUS_MALQUEUE_STARTED
// - if send = count all => status == PROCESS_FINISHED
foreach ($sendObjectList as $sendObject) {
    // set startdate only at the first time
    if ($sendObject->attribute('status') == CjwNewsletterEditionSend::STATUS_MAILQUEUE_CREATED) {
        // if ok, set status == STATUS_MAILQUEUE_PROCESS_STARTED
        $sendObject->setAttribute('status', CjwNewsletterEditionSend::STATUS_MAILQUEUE_PROCESS_STARTED);
        $sendObject->store();
        $message = "Status set: editonSend  STATUS_MAILQUEUE_PROCESS_STARTED";
        $cli->output($message);
Ejemplo n.º 10
0
 /**
  * Mainfunction for mail send
  *
  * @param unknown_type $emailSender
  * @param unknown_type $emailSenderName
  * @param unknown_type $emailReceiver
  * @param unknown_type $emailReceiverName
  * @param unknown_type $emailSubject
  * @param unknown_type $emailBodyArray
  * @param boolean $isPreview
  * @param string $emailCharset
  * @return array
  */
 public function sendEmail($emailSender, $emailSenderName, $emailReceiver, $emailReceiverName, $emailSubject, $emailBodyArray, $isPreview = false, $emailCharset = 'utf-8')
 {
     $transportMethod = $this->transportMethod;
     //$mail = new ezcMailComposer();
     $mail = new CjwNewsletterMailComposer();
     $mail->charset = $emailCharset;
     $mail->subjectCharset = $emailCharset;
     // from and to addresses, and subject
     $mail->from = new ezcMailAddress(trim($emailSender), $emailSenderName);
     // returnpath for email bounces
     $mail->returnPath = new ezcMailAddress(trim($emailSender));
     if ($isPreview) {
         $explodeReceiverArr = explode(';', $emailReceiver);
         foreach ($explodeReceiverArr as $index => $receiver) {
             // check if email
             if ($receiver != '') {
                 $mail->addTo(new ezcMailAddress(trim($receiver), 'NL Test Receiver' . $index));
             }
         }
     } else {
         $mail->addTo(new ezcMailAddress(trim($emailReceiver), $emailReceiverName));
     }
     if (array_key_exists('html', $emailBodyArray) == false) {
         $emailBodyArray['html'] = '';
     }
     if (array_key_exists('text', $emailBodyArray) == false) {
         $emailBodyArray['text'] = '';
     }
     $mail->subject = $emailSubject;
     if ($emailBodyArray['html'] == '') {
         // tue nix - da kein html da ist
     } else {
         $mail->htmlText = $emailBodyArray['html'];
     }
     // body: plain
     // $mail->plainText = "Here is the text version of the mail.";
     if ($emailBodyArray['text'] == '') {
         // $mail->plainText = "Text version of this mail does not exists.";
     } else {
         $mail->plainText = $emailBodyArray['text'];
     }
     $emailContentType = '';
     if ($emailBodyArray['html'] != '' && $emailBodyArray['text'] != '') {
         $emailContentType = 'multipart/alternative';
     } else {
         if ($emailBodyArray['html'] != '') {
             $emailContentType = 'text/html';
         } elseif ($emailBodyArray['text'] != '') {
             $emailContentType = 'text/plain';
         }
     }
     // http://ezcomponents.org/docs/api/latest/introduction_Mail.html#mta-qmail
     // HeaderLineEnding=auto
     // CRLF - windows - \r\n
     // CR - mac - \r
     // LF - UNIX-MACOSX - \n
     // default LF
     //ezcMailTools::setLineBreak( "\n" );
     ezcMailTools::setLineBreak($this->HeaderLineEnding);
     // set 'x-cjwnl-' mailheader
     foreach ($this->ExtraEmailHeaderItemArray as $key => $value) {
         $mail->setHeader($key, $value);
     }
     $mail->build();
     $transport = new CjwNewsletterTransport($transportMethod);
     $sendResult = $transport->send($mail);
     $emailResult = array('send_result' => $sendResult, 'email_sender' => $emailSender, 'email_receiver' => $emailReceiver, 'email_subject' => $emailSubject, 'email_content_type' => $emailContentType, 'email_charset' => $emailCharset, 'transport_method' => $transportMethod);
     // ok
     if ($sendResult) {
         CjwNewsletterLog::writeInfo('email send ok', 'CjwNewsletterMail', 'sendEmail', $emailResult);
     } else {
         CjwNewsletterLog::writeError('email send failed', 'CjwNewsletterMail', 'sendEmail', $emailResult);
     }
     // $LogFile->write( $message, $logName, $logFolder );
     return $emailResult;
 }
Ejemplo n.º 11
0
 /**
  * fetch mails to parse and/or store
  *
  * @return void
  */
 public function fetchMails()
 {
     $statusArray = array('added' => array(), 'exists' => array(), 'failed' => array());
     $mailboxId = $this->attribute('id');
     $mailboxDeleteMailsFromServer = (bool) $this->attribute('delete_mails_from_server');
     if (is_object($this->TransportObject)) {
         $transport = $this->TransportObject;
         try {
             // it is possible that not all pop3 server understand this
             // array( message_num => unique_id );
             // array( 1 => '000001fc4420e93a', 2 => '000001fd4420e93a' );
             $uniqueIdentifierArray = $transport->listUniqueIdentifiers();
         } catch (Exception $e) {
             $uniqueIdentifiers = false;
             CjwNewsletterLog::writeError('CjwNewsletterMailbox::fetchMails', 'mailbox', 'listUniqueIdentifiers-failed', array('error-code' => $e->getMessage()));
         }
         try {
             // array( message_id => message_size );
             // array( 2 => 1700, 5 => 1450 );
             $messageIdArray = $transport->listMessages();
         } catch (Exception $e) {
             $messageIdNumbers = false;
             CjwNewsletterLog::writeError('CjwNewsletterMailbox::fetchMails', 'mailbox', 'listMessages-failed', array('error-code' => $e->getMessage()));
         }
         // array( message_id => message_identifier )
         $messageNumberArray = array();
         // only fetch messages from server which are not in the db
         // use message_identifier for check
         $existingMessageIdentifierArray = $this->extractAllExistingIdentifiers($uniqueIdentifierArray);
         foreach ($messageIdArray as $messageId => $messageSize) {
             if (isset($uniqueIdentifierArray[$messageId])) {
                 $uniqueIdentifier = $uniqueIdentifierArray[$messageId];
             } else {
                 $uniqueIdentifier = false;
             }
             if (array_key_exists($uniqueIdentifier, $existingMessageIdentifierArray)) {
                 $statusArray['exists'][$messageId] = $uniqueIdentifier;
             } else {
                 $messageNumberArray[$messageId] = $uniqueIdentifier;
             }
         }
         if (count($messageNumberArray) > 0) {
             // only fetch x item at once to avoid script timeout ... if call from admin frontend
             // the cronjob may be has other settings
             $fetchLimit = 50;
             $counter = 0;
             foreach ($messageNumberArray as $messageId => $messageIdentifier) {
                 if ($counter >= $fetchLimit) {
                     break;
                 } else {
                     // create mailobject from message id
                     // $mailboxDeleteMailsFromServer == true, set delete flag for current message
                     $mailObject = $transport->fetchByMessageNr($messageId, $mailboxDeleteMailsFromServer);
                     // convert mailobject to string with own function
                     $messageString = $this->convertMailToString($mailObject);
                     if ($messageIdentifier === false) {
                         $messageIdentifier = 'cjwnl_' . md5($messageString);
                     }
                     // if messageString has content
                     if ($messageString != null) {
                         // add item to DB / Filesystem
                         $addResult = CjwNewsletterMailboxItem::addMailboxItem($mailboxId, $messageIdentifier, $messageId, $messageString);
                         if (is_object($addResult)) {
                             $statusArray['added'][$messageId] = $messageIdentifier;
                         } else {
                             $statusArray['exists'][$messageId] = $messageIdentifier;
                         }
                         unset($addResult);
                     } else {
                         $statusArray['failed'][$messageId] = $messageIdentifier;
                     }
                     unset($messageString);
                     unset($mailObject);
                 }
                 $counter++;
             }
             // delete messages with delete flag from mailbox
             switch ($this->attribute('type')) {
                 case 'imap':
                     $transport->expunge();
                     break;
             }
         } else {
             return $statusArray;
         }
     }
     return $statusArray;
 }
Ejemplo n.º 12
0
 /**
  * Mainfunction for mail send
  *
  * @param unknown_type $emailSender
  * @param unknown_type $emailSenderName
  * @param unknown_type $emailReceiver
  * @param unknown_type $emailReceiverName
  * @param unknown_type $emailSubject
  * @param unknown_type $emailBodyArray
  * @param boolean $isPreview
  * @param string $emailCharset
  * @return array
  */
 public function sendEmail($emailSender, $emailSenderName, $emailReceiver, $emailReceiverName, $emailSubject, $emailBodyArray, $isPreview = false, $emailCharset = 'utf-8', $emailReplyTo = false, $emailReturnPath = false)
 {
     $transportMethod = $this->transportMethod;
     //$mail = new ezcMailComposer();
     $mail = new CjwNewsletterMailComposer();
     // Encode the UTF-8 as base64 or QUOTED_PRINTABLE for 7 bit MTAs
     // $mail->encoding = ezcMail::BASE64;
     // $mail->encoding = ezcMail::QUOTED_PRINTABLE;
     $mail->encoding = $this->ContentTransferEncoding;
     $mail->charset = $emailCharset;
     $mail->subjectCharset = $emailCharset;
     // from and to addresses, and subject
     $mail->from = new ezcMailAddress(trim($emailSender), $emailSenderName, $mail->charset);
     // returnpath for email bounces
     if (!($emailReturnPath && $emailReturnPath != '')) {
         $mail->returnPath = $mail->from;
     } else {
         $mail->returnPath = new ezcMailAddress(trim($emailReturnPath), '', $mail->charset);
     }
     $mail->setHeader('Errors-To', $mail->returnPath);
     // reply-to
     if (!($emailReplyTo && $emailReplyTo != '')) {
         $mail->setHeader('Reply-To', $mail->from);
     } else {
         $mail->setHeader('Reply-To', new ezcMailAddress(trim($emailReplyTo), '', $mail->charset));
     }
     if ($isPreview) {
         $explodeReceiverArr = explode(';', $emailReceiver);
         foreach ($explodeReceiverArr as $index => $receiver) {
             // check if email
             if ($receiver != '') {
                 $mail->addTo(new ezcMailAddress(trim($receiver), 'NL Test Receiver' . $index, $mail->charset));
             }
         }
     } else {
         $mail->addTo(new ezcMailAddress(trim($emailReceiver), $emailReceiverName, $mail->charset));
     }
     if (array_key_exists('html', $emailBodyArray) == false) {
         $emailBodyArray['html'] = '';
     }
     if (array_key_exists('text', $emailBodyArray) == false) {
         $emailBodyArray['text'] = '';
     }
     $mail->subject = $emailSubject;
     if ($emailBodyArray['html'] == '') {
         // tue nix - da kein html da ist
     } else {
         $mail->htmlText = $emailBodyArray['html'];
     }
     // body: plain
     // $mail->plainText = "Here is the text version of the mail.";
     if ($emailBodyArray['text'] == '') {
         // $mail->plainText = "Text version of this mail does not exists.";
     } else {
         $mail->plainText = $emailBodyArray['text'];
     }
     $emailContentType = '';
     if ($emailBodyArray['html'] != '' && $emailBodyArray['text'] != '') {
         $emailContentType = 'multipart/alternative';
     } else {
         if ($emailBodyArray['html'] != '') {
             $emailContentType = 'text/html';
         } elseif ($emailBodyArray['text'] != '') {
             $emailContentType = 'text/plain';
         }
     }
     // http://ezcomponents.org/docs/api/latest/introduction_Mail.html#mta-qmail
     // HeaderLineEnding=auto
     // CRLF - windows - \r\n
     // CR - mac - \r
     // LF - UNIX-MACOSX - \n
     // default LF
     //ezcMailTools::setLineBreak( "\n" );
     ezcMailTools::setLineBreak($this->HeaderLineEnding);
     // set 'x-cjwnl-' mailheader
     foreach ($this->ExtraEmailHeaderItemArray as $key => $value) {
         $mail->setHeader($key, $value, $mail->charset);
     }
     $mail->build();
     $transport = new CjwNewsletterTransport($transportMethod);
     $sendResult = $transport->send($mail);
     $emailResult = array('send_result' => $sendResult, 'email_sender' => $emailSender, 'email_receiver' => $emailReceiver, 'email_subject' => $emailSubject, 'email_content_type' => $emailContentType, 'email_charset' => $emailCharset, 'transport_method' => $transportMethod);
     // ok
     if ($sendResult === true) {
         CjwNewsletterLog::writeInfo('email send ok', 'CjwNewsletterMail', 'sendEmail', $emailResult);
     } else {
         // An error occured while sending or receiving mail. RCPT TO failed with error: 450 4.1.2
         // <*****@*****.**>: Recipient address rejected: Domain not found
         // is string ' 450 ' included in emailResult
         $searchString = ' 450 ';
         $addErrorMessage = '';
         if (strpos($sendResult, $searchString) !== false) {
             // check if we found an email nl user for emailReceiver
             $nlUserToBounce = CjwNewsletterUser::fetchByEmail($emailReceiver);
             if (is_object($nlUserToBounce)) {
                 // hardbounce user
                 // alle active element will be aborted, too
                 $nlUserToBounce->setBounced(true);
                 $emailResult['nluser_id'] = $nlUserToBounce->attribute('id');
                 $addErrorMessage = ' - HARD BOUNCE (450)';
             } else {
                 $addErrorMessage = ' - NL User for email not found';
             }
         }
         CjwNewsletterLog::writeError('email send failed to ' . $emailReceiver . $addErrorMessage, 'CjwNewsletterMail', 'sendEmail', $emailResult);
     }
     // $LogFile->write( $message, $logName, $logFolder );
     return $emailResult;
 }