/** * Make it possible to get header values via $mail->to and the like */ public function __get($name) { $name = ucfirst($name); if (array_key_exists($name, $this->headers)) { return $this->headers[$name]; } return parent::__get($name); }