| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * AddressStructure.class.php |
| 5 | * |
| 6 | * Copyright (c) 2002 The SquirrelMail Project Team |
| 7 | * Licensed under the GNU GPL. For full terms see the file COPYING. |
| 8 | * |
| 9 | * This contains functions needed to handle mime messages. |
| 10 | * |
| 11 | * $Id$ |
| 12 | */ |
| 13 | |
| 14 | class AddressStructure { |
| 15 | var $personal = '', |
| 16 | $adl = '', |
| 17 | $mailbox = '', |
| 18 | $host = '', |
| 19 | $group = ''; |
| 20 | |
| 21 | function getAddress($full = true) { |
| 22 | $result = ''; |
| 23 | |
| 24 | if (is_object($this)) { |
| 25 | if (isset($this->host) && ($this->host != '')) { |
| 26 | $email = $this->mailbox.'@'.$this->host; |
| 27 | } else { |
| 28 | $email = $this->mailbox; |
| 29 | } |
| 30 | if (trim($this->personal) != '') { |
| 31 | if ($email) { |
| 32 | $addr = '"' . $this->personal . '" <' .$email.'>'; |
| 33 | } else { |
| 34 | $addr = $this->personal; |
| 35 | } |
| 36 | $best_dpl = $this->personal; |
| 37 | } else { |
| 38 | $addr = $email; |
| 39 | $best_dpl = $email; |
| 40 | } |
| 41 | $result = ($full ? $addr : $best_dpl); |
| 42 | } |
| 43 | return $result; |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | ?> |