Overview
  • Package
  • Class
  • Tree
  • Todo

Packages

  • AddonValue
    • Interfaces
  • ApiV2Controllers
  • Category
    • Collections
    • Entities
    • Factories
    • Interfaces
    • Providers
    • Repositories
    • Storages
  • Customer
    • Address
    • Country
    • CountryZone
    • Interfaces
    • Validation
    • ValueObjects
  • Email
    • Collections
    • Entities
    • Exceptions
    • Interfaces
    • Repository
    • ValueObjects
  • Http
    • Collections
    • Exceptions
    • Factories
    • Interfaces
    • ValueObjects
  • Loaders
    • CrossCuttingLoader
    • GXCoreLoader
    • Interfaces
  • None
  • Order
    • Collections
    • Entities
    • Factories
    • Interfaces
    • Repositories
    • Storages
    • ValueObjects
  • Product
    • Collections
    • Entities
    • Factories
    • Interfaces
    • Providers
    • Repositories
    • Storages
  • ProductModule
    • Collections
    • Deleter
    • Entities
    • Factories
    • Interface
    • Interfaces
    • Reader
    • Repositories
    • Writer
  • Shared
    • Exceptions
    • FileSystem
    • Interfaces
    • Storage
    • Types
  • Statistics
    • Interfaces
  • UserConfiguration
    • Interfaces
    • Repository

Classes

  • AbstractAddonValueServiceFactory
  • AbstractAddonValueStorage
  • AbstractApiV2Controller
  • AbstractCategoryServiceFactory
  • AbstractCollection
  • AbstractCustomerFactory
  • AbstractCustomerServiceFactory
  • AbstractFileStorage
  • AbstractHttpContextFactory
  • AbstractHttpViewControllerRegistryFactory
  • AbstractImagesApiV2Controller
  • AbstractOrderServiceFactory
  • AbstractProductAttributeServiceFactory
  • AbstractProductServiceFactory
  • AddonValueService
  • AddonValueServiceFactory
  • AddonValueStorageFactory
  • AddressBlock
  • AddressBookService
  • AddressClass
  • AddressesApiV2Controller
  • AddressFormatProvider
  • AdminHttpViewController
  • AdminPageHttpControllerResponse
  • Asset
  • AssetCollection
  • AttachmentCollection
  • AttachmentName
  • AttachmentPath
  • AttachmentsApiV2Controller
  • AttachmentsHandler
  • BoolType
  • CategoriesApiV2Controller
  • Category
  • CategoryAddonValueStorage
  • CategoryFactory
  • CategoryIconsApiV2Controller
  • CategoryImagesApiV2Controller
  • CategoryListItem
  • CategoryListItemCollection
  • CategoryListProvider
  • CategoryListProviderFactory
  • CategoryObjectService
  • CategoryReadService
  • CategoryRepository
  • CategoryRepositoryDeleter
  • CategoryRepositoryReader
  • CategoryRepositoryWriter
  • CategoryServiceFactory
  • CategorySettings
  • CategorySettingsRepository
  • CategorySettingsRepositoryReader
  • CategorySettingsRepositoryWriter
  • CategoryWriteService
  • ContactCollection
  • ContactName
  • ContactType
  • CountriesApiV2Controller
  • CountryService
  • CrossCuttingLoader
  • CurrencyCode
  • Customer
  • CustomerAccountInputValidator
  • CustomerAddress
  • CustomerAddressDeleter
  • CustomerAddressInputValidator
  • CustomerAddressReader
  • CustomerAddressRepository
  • CustomerAddressWriter
  • CustomerB2BStatus
  • CustomerCallNumber
  • CustomerCity
  • CustomerCompany
  • CustomerCountry
  • CustomerCountryIso2
  • CustomerCountryIso3
  • CustomerCountryName
  • CustomerCountryReader
  • CustomerCountryRepository
  • CustomerCountryZone
  • CustomerCountryZoneIsoCode
  • CustomerCountryZoneName
  • CustomerCountryZoneReader
  • CustomerCountryZoneRepository
  • CustomerDateOfBirth
  • CustomerDeleter
  • CustomerEmail
  • CustomerFactory
  • CustomerFirstname
  • CustomerGender
  • CustomerInputValidator
  • CustomerInputValidatorSettings
  • CustomerLastname
  • CustomerNumber
  • CustomerPassword
  • CustomerPostcode
  • CustomerReader
  • CustomerReadService
  • CustomerRegistrationInputValidatorService
  • CustomerRepository
  • CustomersApiV2Controller
  • CustomerService
  • CustomerServiceFactory
  • CustomerServiceSettings
  • CustomerStatusInformation
  • CustomerStatusProvider
  • CustomerStreet
  • CustomerSuburb
  • CustomerVatNumber
  • CustomerWriter
  • CustomerWriteService
  • DecimalType
  • DefaultApiV2Controller
  • EditableCollection
  • EditableKeyValueCollection
  • Email
  • EmailAddress
  • EmailAttachment
  • EmailCollection
  • EmailContact
  • EmailContent
  • EmailDeleter
  • EmailFactory
  • EmailReader
  • EmailRepository
  • EmailsApiV2Controller
  • EmailService
  • EmailStringType
  • EmailSubject
  • EmailWriter
  • EmptyCurrencyCode
  • EmptyDateTime
  • EmptyLanguageCode
  • EmptyOrderItemDownloadInformation
  • EmptyProductImage
  • EnvCategoryServiceSettings
  • EnvironmentHttpContextFactory
  • EnvironmentHttpViewControllerRegistryFactory
  • EnvProductImageFileStorageSettings
  • ExistingDirectory
  • ExistingFile
  • FilenameStringType
  • GXCoreLoader
  • GXCoreLoaderSettings
  • GXEngineOrder
  • GXEngineProduct
  • HttpApiV2Controller
  • HttpContext
  • HttpContextReader
  • HttpControllerResponse
  • HttpDispatcher
  • HttpResponseProcessor
  • HttpService
  • HttpServiceFactory
  • HttpViewController
  • HttpViewControllerFactory
  • HttpViewControllerRegistry
  • IdCollection
  • IdType
  • ImageFileStorage
  • IntType
  • JsonHttpControllerResponse
  • KeyValueCollection
  • LanguageCode
  • LegacyProductImageProcessing
  • MailerAdapter
  • NonEmptyStringType
  • OrderAddonValueStorage
  • OrderFactory
  • OrderItem
  • OrderItemAddonValueStorage
  • OrderItemAttribute
  • OrderItemAttributeCollection
  • OrderItemAttributeFactory
  • OrderItemAttributeRepository
  • OrderItemAttributeRepositoryDeleter
  • OrderItemAttributeRepositoryFactory
  • OrderItemAttributeRepositoryReader
  • OrderItemAttributeRepositoryWriter
  • OrderItemCollection
  • OrderItemDownloadInformation
  • OrderItemFactory
  • OrderItemProperty
  • OrderItemPropertyFactory
  • OrderItemPropertyRepository
  • OrderItemPropertyRepositoryDeleter
  • OrderItemPropertyRepositoryReader
  • OrderItemPropertyRepositoryWriter
  • OrderItemRepository
  • OrderItemRepositoryDeleter
  • OrderItemRepositoryReader
  • OrderItemRepositoryWriter
  • OrderListGenerator
  • OrderListItem
  • OrderListItemCollection
  • OrderObjectService
  • OrderPaymentType
  • OrderReadService
  • OrderRepository
  • OrderRepositoryDeleter
  • OrderRepositoryReader
  • OrderRepositoryWriter
  • OrdersApiV2Controller
  • OrderServiceFactory
  • OrderServiceSettings
  • OrderShippingType
  • OrdersHistoryApiV2Controller
  • OrdersItemsApiV2Controller
  • OrdersItemsAttributesApiV2Controller
  • OrderStatusHistoryListItem
  • OrderStatusHistoryListItemCollection
  • OrderStatusHistoryStorage
  • OrdersTotalsApiV2Controller
  • OrderTotal
  • OrderTotalCollection
  • OrderTotalFactory
  • OrderTotalRepository
  • OrderTotalRepositoryDeleter
  • OrderTotalRepositoryReader
  • OrderTotalRepositoryWriter
  • OrderWriteService
  • ProductAddonValueStorage
  • ProductAttribute
  • ProductAttributeCollection
  • ProductAttributeFactory
  • ProductAttributeObjectService
  • ProductAttributeRepository
  • ProductAttributeRepositoryDeleter
  • ProductAttributeRepositoryReader
  • ProductAttributeRepositoryWriter
  • ProductAttributeService
  • ProductAttributeServiceFactory
  • ProductCategoryLinker
  • ProductFactory
  • ProductImage
  • ProductImageCollection
  • ProductImageContainer
  • ProductImageContainerRepository
  • ProductImageFileStorage
  • ProductImagesApiV2Controller
  • ProductListItem
  • ProductListItemCollection
  • ProductListProvider
  • ProductListProviderFactory
  • ProductObjectService
  • ProductPermissionSetter
  • ProductReadService
  • ProductRepository
  • ProductRepositoryDeleter
  • ProductRepositoryReader
  • ProductRepositoryWriter
  • ProductsApiV2Controller
  • ProductServiceFactory
  • ProductSettings
  • ProductSettingsRepository
  • ProductSettingsRepositoryReader
  • ProductSettingsRepositoryWriter
  • ProductsLinksApiV2Controller
  • ProductWriteService
  • RedirectHttpControllerResponse
  • StaticCrossCuttingLoader
  • StaticGXCoreLoader
  • StatisticsService
  • StoredCategory
  • StoredOrderItem
  • StoredOrderItemAttribute
  • StoredOrderItemAttributeCollection
  • StoredOrderItemCollection
  • StoredOrderItemProperty
  • StoredOrderTotal
  • StoredOrderTotalCollection
  • StoredProduct
  • StoredProductAttribute
  • StoredProductAttributeCollection
  • StringCollection
  • StringType
  • UserConfigurationReader
  • UserConfigurationService
  • UserConfigurationWriter
  • VatNumberValidator
  • WritableDirectory
  • WritableFile
  • YetAnotherLanguageProvider
  • ZonesApiV2Controller

Interfaces

  • AddonValueContainerInterface
  • AddonValueServiceInterface
  • AddonValueStorageFactoryInterface
  • AddressBlockInterface
  • AddressBookServiceInterface
  • AddressClassInterface
  • AddressFormatProviderInterface
  • AssetCollectionInterface
  • AssetInterface
  • AttachmentCollectionInterface
  • AttachmentNameInterface
  • AttachmentPathInterface
  • AttachmentsHandlerInterface
  • CategoryFactoryInterface
  • CategoryInterface
  • CategoryListProviderFactoryInterface
  • CategoryListProviderInterface
  • CategoryObjectServiceInterface
  • CategoryReadServiceInterface
  • CategoryRepositoryDeleterInterface
  • CategoryRepositoryInterface
  • CategoryRepositoryReaderInterface
  • CategoryRepositoryWriterInterface
  • CategoryServiceSettingsInterface
  • CategorySettingsInterface
  • CategorySettingsRepositoryInterface
  • CategorySettingsRepositoryReaderInterface
  • CategorySettingsRepositoryWriterInterface
  • CategoryWriteServiceInterface
  • ContactCollectionInterface
  • ContactNameInterface
  • ContactTypeInterface
  • ContentViewInterface
  • CountryServiceInterface
  • CrossCuttingLoaderInterface
  • CrossCuttingObjectInterface
  • CustomerAccountInputValidatorInterface
  • CustomerAddressDeleterInterface
  • CustomerAddressInputValidatorInterface
  • CustomerAddressInterface
  • CustomerAddressReaderInterface
  • CustomerAddressRepositoryInterface
  • CustomerAddressWriterInterface
  • CustomerB2BStatusInterface
  • CustomerCallNumberInterface
  • CustomerCityInterface
  • CustomerCompanyInterface
  • CustomerCountryInterface
  • CustomerCountryIso2Interface
  • CustomerCountryIso3Interface
  • CustomerCountryNameInterface
  • CustomerCountryReaderInterface
  • CustomerCountryRepositoryInterface
  • CustomerCountryZoneInterface
  • CustomerCountryZoneIsoCodeInterface
  • CustomerCountryZoneNameInterface
  • CustomerCountryZoneReaderInterface
  • CustomerCountryZoneRepositoryInterface
  • CustomerDeleterInterface
  • CustomerEmailInterface
  • CustomerFirstnameInterface
  • CustomerGenderInterface
  • CustomerInputValidatorInterface
  • CustomerInputValidatorSettingsInterface
  • CustomerInterface
  • CustomerLastnameInterface
  • CustomerNumberInterface
  • CustomerPasswordInterface
  • CustomerPostcodeInterface
  • CustomerReaderInterface
  • CustomerReadServiceInterface
  • CustomerRegistrationInputValidatorServiceInterface
  • CustomerRepositoryInterface
  • CustomerServiceInterface
  • CustomerServiceSettingsInterface
  • CustomerStatusProviderInterface
  • CustomerStreetInterface
  • CustomerSuburbInterface
  • CustomerVatNumberInterface
  • CustomerWriterInterface
  • CustomerWriteServiceInterface
  • EmailAddressInterface
  • EmailAttachmentInterface
  • EmailCollectionInterface
  • EmailContactInterface
  • EmailContentInterface
  • EmailDeleterInterface
  • EmailFactoryInterface
  • EmailInterface
  • EmailReaderInterface
  • EmailRepositoryInterface
  • EmailServiceInterface
  • EmailSubjectInterface
  • EmailWriterInterface
  • GXCoreLoaderInterface
  • GXCoreLoaderSettingsInterface
  • HttpContextInterface
  • HttpContextReaderInterface
  • HttpControllerResponseInterface
  • HttpDispatcherInterface
  • HttpResponseProcessorInterface
  • HttpServiceFactoryInterface
  • HttpServiceInterface
  • HttpViewControllerFactoryInterface
  • HttpViewControllerInterface
  • HttpViewControllerRegistryInterface
  • IdInterface
  • LanguageProviderInterface
  • MailerAdapterInterface
  • OrderFactoryInterface
  • OrderInterface
  • OrderItemAttributeFactoryInterface
  • OrderItemAttributeInterface
  • OrderItemAttributeRepositoryDeleterInterface
  • OrderItemAttributeRepositoryFactoryInterface
  • OrderItemAttributeRepositoryInterface
  • OrderItemAttributeRepositoryReaderInterface
  • OrderItemAttributeRepositoryWriterInterface
  • OrderItemFactoryInterface
  • OrderItemInterface
  • OrderItemPropertyFactoryInterface
  • OrderItemPropertyRepositoryDeleterInterface
  • OrderItemPropertyRepositoryReaderInterface
  • OrderItemPropertyRepositoryWriterInterface
  • OrderItemRepositoryDeleterInterface
  • OrderItemRepositoryInterface
  • OrderItemRepositoryReaderInterface
  • OrderItemRepositoryWriterInterface
  • OrderListGeneratorInterface
  • OrderObjectServiceInterface
  • OrderPaymentTypeInterface
  • OrderReadServiceInterface
  • OrderRepositoryDeleterInterface
  • OrderRepositoryInterface
  • OrderRepositoryReaderInterface
  • OrderRepositoryWriterInterface
  • OrderServiceSettingsInterface
  • OrderShippingTypeInterface
  • OrderStatusHistoryReaderInterface
  • OrderStatusHistoryWriterInterface
  • OrderTotalFactoryInterface
  • OrderTotalInterface
  • OrderTotalRepositoryDeleterInterface
  • OrderTotalRepositoryInterface
  • OrderTotalRepositoryReaderInterface
  • OrderTotalRepositoryWriterInterface
  • OrderWriteServiceInterface
  • ProductAttributeFactoryInterface
  • ProductAttributeInterface
  • ProductAttributeObjectServiceInterface
  • ProductAttributeRepositoryDeleterInterface
  • ProductAttributeRepositoryInterface
  • ProductAttributeRepositoryReaderInterface
  • ProductAttributeRepositoryWriterInterface
  • ProductAttributeServiceInterface
  • ProductCategoryLinkerInterface
  • ProductFactoryInterface
  • ProductImageContainerInterface
  • ProductImageContainerRepositoryInterface
  • ProductImageInterface
  • ProductImagePathsSettingsInterface
  • ProductImageProcessingInterface
  • ProductInterface
  • ProductListProviderFactoryInterface
  • ProductListProviderInterface
  • ProductObjectServiceInterface
  • ProductPermissionSetterInterface
  • ProductReadServiceInterface
  • ProductRepositoryDeleterInterface
  • ProductRepositoryInterface
  • ProductRepositoryReaderInterface
  • ProductRepositoryWriterInterface
  • ProductSettingsInterface
  • ProductSettingsRepositoryInterface
  • ProductSettingsRepositoryReaderInterface
  • ProductSettingsRepositoryWriterInterface
  • ProductWriteServiceInterface
  • StatisticsServiceInterface
  • StoredCategoryInterface
  • StoredOrderItemAttributeInterface
  • StoredOrderItemInterface
  • StoredOrderTotalInterface
  • StoredProductAttributeInterface
  • StoredProductInterface
  • UserConfigurationReaderInterface
  • UserConfigurationServiceInterface
  • UserConfigurationWriterInterface
  • VatNumberValidatorInterface

Exceptions

  • AjaxException
  • AttachmentNotFoundException
  • FileNotFoundException
  • HttpApiV2Exception
  • MissingControllerNameException
  • UnknownEnvironmentException
  1 <?php
  2 /* --------------------------------------------------------------
  3    EmailFactory.inc.php 2015-07-21 gm
  4    Gambio GmbH
  5    http://www.gambio.de
  6    Copyright (c) 2015 Gambio GmbH
  7    Released under the GNU General Public License (Version 2)
  8    [http://www.gnu.org/licenses/gpl-2.0.html]
  9    --------------------------------------------------------------
 10 */
 11 
 12 MainFactory::load_class('EmailFactoryInterface');
 13 
 14 /**
 15  * Class EmailFactory
 16  *
 17  * @category System
 18  * @package  Email
 19  */
 20 class EmailFactory implements EmailFactoryInterface
 21 {
 22     /**
 23      * Query builder.
 24      * @var CI_DB_query_builder
 25      */
 26     protected $db;
 27 
 28 
 29     /**
 30      * Class Constructor
 31      *
 32      * @param CI_DB_query_builder $db Query builder.
 33      */
 34     public function __construct(CI_DB_query_builder $db)
 35     {
 36         $this->db = $db;
 37     }
 38 
 39 
 40     /**
 41      * Creates an email object
 42      *
 43      * @param IdType                        $id           (optional) E-Mail ID.
 44      * @param EmailSubjectInterface         $subject      (optional) E-Mail subject.
 45      * @param EmailContentInterface         $contentPlain (optional) E-Mail plain content.
 46      * @param EmailContentInterface         $contentHtml  (optional) E-Mail HTML content.
 47      * @param bool                          $p_isPending  (optional) E-Mail is pending?
 48      * @param ContactCollectionInterface    $contacts     (optional) E-Mail contacts.
 49      * @param AttachmentCollectionInterface $attachments  (optional) E-Mail attachments.
 50      *
 51      * @throws InvalidArgumentException If '$p_isPending' is not a bool, or if any other argument is not valid.
 52      * @throws UnexpectedValueException If the contact type was not found
 53      *
 54      * @return Email The created email.
 55      */
 56     public function createEmail(IdType $id = null,
 57                                 EmailSubjectInterface $subject = null,
 58                                 EmailContentInterface $contentHtml = null,
 59                                 EmailContentInterface $contentPlain = null,
 60                                 $p_isPending = true,
 61                                 ContactCollectionInterface $contacts = null,
 62                                 AttachmentCollectionInterface $attachments = null)
 63 
 64     {
 65         if(!is_bool($p_isPending))
 66         {
 67             throw new InvalidArgumentException('Invalid $p_isPending argument given (bool expected): '
 68                                                . print_r($p_isPending, true));
 69         }
 70 
 71         $email = MainFactory::create('Email');
 72 
 73         // Set email information.
 74         if($id !== null)
 75         {
 76             $email->setId($id);
 77         }
 78 
 79         if($subject !== null)
 80         {
 81             $email->setSubject($subject);
 82         }
 83 
 84         if($contentPlain !== null)
 85         {
 86             $email->setContentPlain($contentPlain);
 87         }
 88 
 89         if($contentHtml !== null)
 90         {
 91             $email->setContentHtml($contentHtml);
 92         }
 93 
 94         $email->setPending($p_isPending);
 95 
 96         // Set email contacts.
 97         if($contacts !== null)
 98         {
 99             foreach($contacts->getArray() as $contact)
100             {
101                 switch($contact->getContactType())
102                 {
103                     case ContactType::SENDER:
104                         $email->setSender($contact);
105                         break;
106                     case ContactType::RECIPIENT:
107                         $email->setRecipient($contact);
108                         break;
109                     case ContactType::REPLY_TO:
110                         $email->setReplyTo($contact);
111                         break;
112                     case ContactType::BCC:
113                         $email->getBcc()->add($contact);
114                         break;
115                     case ContactType::CC:
116                         $email->getCc()->add($contact);
117                         break;
118                     default:
119                         throw new UnexpectedValueException('Unexpected contact type: ' . $contact->getContactType());
120                 }
121             }
122         }
123 
124         // Set email attachments collection.
125         if($attachments !== null)
126         {
127             $email->setAttachments($attachments);
128         }
129 
130         return $email;
131     }
132 
133 
134     /**
135      * Creates an email contact object
136      *
137      * @param EmailAddressInterface $emailAddress Email address of the contact.
138      * @param ContactTypeInterface  $contactType  Contact type (see ContactType class definition).
139      * @param ContactNameInterface  $contactName  (optional) Contact display name.
140      *
141      * @return EmailContact The created email contact.
142      */
143     public function createContact(EmailAddressInterface $emailAddress,
144                                   ContactTypeInterface $contactType,
145                                   ContactNameInterface $contactName = null)
146     {
147         return MainFactory::create('EmailContact', $emailAddress, $contactType, $contactName);
148     }
149 
150 
151     /**
152      * Creates an email attachment object
153      *
154      * @param AttachmentPathInterface $path Valid path of the attachment (on the server).
155      * @param AttachmentNameInterface $name (optional) Display name for the attachment.
156      *
157      * @return EmailAttachment The created email attachment.
158      */
159     public function createAttachment(AttachmentPathInterface $path, AttachmentNameInterface $name = null)
160     {
161         return MainFactory::create('EmailAttachment', $path, $name);
162     }
163 
164 
165     /**
166      * Creates a mailer adapter object
167      *
168      * @return MailerAdapter The created mailer adapter.
169      */
170     public function createMailerAdapter()
171     {
172         $mailer = $this->createMailer();
173 
174         return MainFactory::create('MailerAdapter', $mailer);
175     }
176 
177 
178     /**
179      * Creates a PHP mailer object.
180      *
181      * @param string $protocol (Optional) Provide 'smtp', 'sendmail' or 'mail' if you want to override the
182      *                         EMAIL_TRANSPORT constant.
183      *
184      * @return PHPMailer The created PHP mailer.
185      */
186     public function createMailer($protocol = null)
187     {
188         $mailer            = new PHPMailer(true);
189         $mailer->SMTPDebug = 0; // Disable debug output.
190 
191         // Set PHPMailer CharSet
192         if(isset($_SESSION['language_charset']))
193         {
194             $mailer->CharSet = $_SESSION['language_charset'];
195         }
196         else
197         {
198             $row             = $this->db->get_where(TABLE_LANGUAGES, array('code' => DEFAULT_LANGUAGE))->row_array();
199             $mailer->CharSet = $row['language_charset'];
200         }
201 
202         // Set PHPMailer Language
203         if($_SESSION['language'] === 'german')
204         {
205             $mailer->setLanguage('de', DIR_WS_CLASSES);
206         }
207         else
208         {
209             $mailer->setLanguage('en', DIR_WS_CLASSES);
210         }
211 
212         // Set PHPMailer Protocol
213         $protocol = ($protocol !== null) ? $protocol : EMAIL_TRANSPORT;
214         
215         switch($protocol)
216         {
217             case 'smtp':
218                 $mailer->IsSMTP();
219                 $mailer->SMTPKeepAlive = true; // set mailer to use SMTP
220                 $mailer->SMTPAuth      = SMTP_AUTH; // turn on SMTP authentication true/false
221                 $mailer->Username      = SMTP_USERNAME; // SMTP username
222                 $mailer->Password      = SMTP_PASSWORD; // SMTP password
223                 $mailer->Host          = SMTP_MAIN_SERVER . ';'
224                                          . SMTP_Backup_Server; // specify main and backup server "smtp1.example.com;smtp2.example.com"
225                 if(SMTP_ENCRYPTION == 'ssl' || SMTP_ENCRYPTION == 'tls')
226                 {
227                     $mailer->SMTPSecure = SMTP_ENCRYPTION;
228                 }
229                 break;
230 
231             case 'sendmail':
232                 $mailer->IsSendmail();
233                 $mailer->Sendmail = SENDMAIL_PATH;
234                 break;
235 
236             case 'mail':
237                 $mailer->IsMail();
238                 break;
239         }
240 
241         return $mailer;
242     }
243 
244 
245     /**
246      * Creates an email service object
247      *
248      * @return EmailService The created email service.
249      */
250     public function createService()
251     {
252         return MainFactory::create('EmailService', $this->createRepository(), $this, $this->createMailerAdapter(),
253                                    $this->createAttachmentsHandler());
254     }
255 
256 
257     /**
258      * Creates an email repository object
259      *
260      * @return EmailRepository The created email repository.
261      */
262     public function createRepository()
263     {
264         return MainFactory::create('EmailRepository', $this->createWriter(), $this->createReader(),
265                                    $this->createDeleter());
266     }
267 
268 
269     /**
270      * Creates an email writer object
271      *
272      * @return EmailWriter The created email writer.
273      */
274     public function createWriter()
275     {
276         return MainFactory::create('EmailWriter', $this->_getDbConnection());
277     }
278 
279 
280     /**
281      * Create EmailReader Object
282      *
283      * @return EmailReader The created email deleter.
284      */
285     public function createReader()
286     {
287         return MainFactory::create('EmailReader', $this->_getDbConnection(), $this);
288     }
289 
290 
291     /**
292      * Creates email deleter object
293      *
294      * @return EmailDeleter The created email deleter.
295      */
296     public function createDeleter()
297     {
298         return MainFactory::create('EmailDeleter', $this->_getDbConnection());
299     }
300 
301 
302     /**
303      * Creates an attachments handler object
304      *
305      * @param string $p_uploadsDirPath (optional) You can specify a custom uploads directory path if you do not want
306      *                                 the default "uploads" directory. The path must contain a "tmp" and an
307      *                                 "attachments" directory otherwise the AttachmentsHandler class will not work
308      *                                 properly.
309      *
310      * @return AttachmentsHandler The created attachments handler.
311      */
312     public function createAttachmentsHandler($p_uploadsDirPath = null)
313     {
314         $uploadsDirPath = (!empty($p_uploadsDirPath)) ? $p_uploadsDirPath : DIR_FS_CATALOG . 'uploads';
315 
316         return MainFactory::create('AttachmentsHandler', $uploadsDirPath);
317     }
318 
319 
320     /**
321      * Returns a database connection.
322      *
323      * @return CI_DB_query_builder Database connection.
324      */
325     protected function _getDbConnection()
326     {
327         return $this->db;
328     }
329 }
330 
API documentation generated by ApiGen