Example #1
0
 /**
  * Constructor
  * 
  * Setup the server configuration in the construcor
  */
 public function __construct(\Foundation\Configuration $config)
 {
     $this->exceptions = true;
     parent::__construct(true);
     $this->subjectPrefix = $config->getMailSubjectPrefix();
     switch ($config->getMailServerType()) {
         case 'php':
             //we don't need to do any addtional setup for PHP mail
             break;
         case 'sendmail':
             $this->IsSendmail();
             break;
         case 'smtp+ssl':
             $this->SMTPSecure();
             //added secure but continue with smtp
         //added secure but continue with smtp
         case 'smtp':
             $this->IsSMTP();
             $this->Host = $config->getMailServerHost();
             if ($config->getMailServerPort()) {
                 $this->Port = $config->getMailServerPort();
             }
             if ($config->getMailServerUsername()) {
                 $this->SMTPAuth();
                 $this->Username = $config->getMailServerUsername();
                 $this->Password = $config->getMailServerPassword();
             }
             break;
     }
     //set the from address to the default and override it later
     if ($config->getMailDefaultFromAddress()) {
         $this->SetFrom($config->getMailDefaultFromAddress(), $config->getMailDefaultFromName(), false);
     }
     if ($config->getMailOverrideToAddress()) {
         $this->AddAddress($config->getMailOverrideToAddress(), $config->getMailOverrideToName());
         $this->isToOverridden = true;
     }
 }