<?php
/**
 * @copyright (c) Kufer Software GmbH, Loisachstrasse 4, D-84453 Mühldorf 
 */

namespace Kufer\KuferTools\Ausgaben\SammelEMail\EmailTasks;


class MailAnAnsprechpartnerCommand extends MailCommand {
  
  protected $ansprechpartner;
  
  
  public function __construct($ansprechpartner)
  {
    $this->ansprechpartner = $ansprechpartner;
  }
  
  public function execute(EmailSendObj $pEmailSendObj) {
    
    
     
    $empfaenger = $this->getAbsenderToInform();
    $empfaengerAry = array($empfaenger);
    
    $versandInformationAry = $this->sendMails( $empfaengerAry, $pEmailSendObj->person, $pEmailSendObj->toolId, $pEmailSendObj->emailContent, $pEmailSendObj->attachStrategy);

    return $versandInformationAry;  
  } 
    
  
  protected function getAbsenderToInform()
  {
    return array('user' => $this->ansprechpartner,
      'username' => $this->ansprechpartner->getVarValue('name_vorname_ohne_komma'),
      'email' => $this->ansprechpartner->email);
  }
}