send() public method

Send email
public send ( string $placeholder, string $message, string $to, string | null $from = null, string | null $attachmentDir = null ) : void
$placeholder string
$message string
$to string
$from string | null
$attachmentDir string | null
return void
 /**
  * Sends email notifications
  *
  * @param string                                $code             Email message type
  * @param Newscoop\Entity\User                  $user             User object
  * @param PaywallBundle\Entity\UserSubscription $userSubscription User's subscription
  */
 public function sendNotification($code, array $recipients = array(), array $data = array())
 {
     if ($this->systemPreferences->PaywallEmailNotifyEnabled != '1') {
         return;
     }
     $now = new \DateTime('now');
     $smarty = $this->templatesService->getSmarty();
     $smarty->assign('user', new \MetaUser($data['user']));
     $smarty->assign('userSubscription', new MetaSubscription($data['subscription']));
     try {
         $message = $this->loadProperMessageTemplateBy($code);
     } catch (\Exception $e) {
         throw new \Exception($e->getMessage());
     }
     $recipients = !empty($recipients) ? $recipients : $this->systemPreferences->PaywallMembershipNotifyEmail;
     $this->emailService->send($this->placeholdersService->get('subject'), $message, $recipients, $this->systemPreferences->PaywallMembershipNotifyFromEmail);
 }