- if (preg_match("/^([^ ]+@[^ ]+) \((.*)\)$/", $this->from, $regs)) {
- $this->name = $regs[2];
- }
- if (preg_match("/^\"?([^<>\"]+)\"? +<(.+@.+)>$/", $this->from, $regs)) {
- $this->name = preg_replace("/^'(.*)'$/", '\1', $regs[1]);
- $this->name = stripslashes($this->name);
- }
- if ($this->name) {
- $this->name = preg_replace("/\\\(\(|\))/","\\1", $this->name);
- } else if (preg_match("/([^< ]+)@([^> ]+)/", $this->from, $regs)) {
- $this->name = $regs[1];
- } else {
- $this->name = 'Anonymous';