[ Index ] |
|
Code source de LifeType 1.2.4 |
1 <?php 2 3 4 5 define( "MAX_LINE_LENGTH", 998 ); 6 7 /** 8 * \ingroup Mail 9 * 10 * Represents an email message and has basic setter and getter methods for all the most 11 * basic attributes of an email message (To:, From:, Bcc:, etc) 12 */ 13 class EmailMessage 14 { 15 16 var $_toAddrs; 17 var $_ccAddrs; 18 var $_bccAddrs; 19 var $_subject; 20 var $_body; 21 var $_mimeType; 22 var $_from; 23 var $_fromName; 24 var $_charset; 25 26 27 /** 28 * Constructor 29 */ 30 function EmailMessage() 31 { 32 33 34 $this->_toAddrs = Array(); 35 $this->_ccAddrs = Array(); 36 $this->_bccAddrs = Array(); 37 // use iso-8859-1 as the default character set 38 $this->_charset = "iso-8859-1"; 39 40 $this->_mimeType = "text/plain"; 41 } 42 43 /** 44 * Adds a destination 45 * 46 * @param to Destination address. 47 */ 48 function addTo( $to ) 49 { 50 array_push( $this->_toAddrs, rtrim($to) ); 51 } 52 53 /** 54 * Adds a Cc: 55 * 56 * @param cc The address where we want to Cc this message 57 */ 58 function addCc( $cc ) 59 { 60 array_push( $this->_ccAddrs, rtrim($cc) ); 61 } 62 63 /** 64 * Adds a Bcc address 65 * 66 * @param bcc The adddress where we want to Bcc 67 */ 68 function addBcc( $bcc ) 69 { 70 array_push( $this->_bccAddrs, rtrim($bcc) ); 71 } 72 73 /** 74 * Sets the from address 75 * 76 * @param from The originatory address 77 */ 78 function setFrom( $from ) 79 { 80 $this->_from = $from; 81 } 82 83 /** 84 * Sets the from name 85 * 86 * @param fromname The originatory name 87 */ 88 function setFromName( $fromname ) 89 { 90 $this->_fromName = $fromname; 91 } 92 93 /** 94 * Sets the subject of the message 95 * 96 * @param subject Subject of the message 97 */ 98 function setSubject( $subject ) 99 { 100 $this->_subject = $subject; 101 } 102 103 /** 104 * Sets the body of the message 105 * 106 * @param body The text for the body of the message 107 */ 108 function setBody( $body ) 109 { 110 $this->_body = $body; 111 } 112 113 /** 114 * Sets the MIME type. The default is 'text/plain' 115 * 116 * @param type The MIME type 117 */ 118 function setMimeType( $type ) 119 { 120 $this->_mimeType = $type; 121 } 122 123 /** 124 * Returns the "To:" list, properly arranged 125 * 126 * @return An string with the 'to:' field 127 */ 128 function getTo() 129 { 130 return $this->_toAddrs; 131 } 132 133 /** 134 * Returns the "Cc:" list, properly arranged 135 * 136 * @return An string with the 'Cc:' field 137 */ 138 function getCc() 139 { 140 return $this->_ccAddrs; 141 } 142 143 /** 144 * Returns the "Bcc:" list, properly arranged 145 * 146 * @return An string with the 'Bcc:' field 147 */ 148 function getBcc() 149 { 150 return $this->_bccAddrs; 151 } 152 153 /** 154 * Returns the From address. 155 * 156 * @return The from address. 157 */ 158 function getFrom() 159 { 160 return $this->_from; 161 } 162 163 /** 164 * Returns the body. 165 * 166 * @return The body. 167 */ 168 function getBody() 169 { 170 return $this->_body; 171 } 172 173 /** 174 * Returns the subject 175 * 176 * @return The subject. 177 */ 178 function getSubject() 179 { 180 return $this->_subject; 181 } 182 183 /** 184 * Gets the MIME content type of the message 185 * 186 * @return The MIME type 187 */ 188 function getMimeType() 189 { 190 return $this->_mimeType; 191 } 192 193 /** 194 * Returns the From name. 195 * 196 * @return The from name. 197 */ 198 function getFromName() 199 { 200 return $this->_fromName; 201 } 202 203 /** 204 * Sets the character set of the message 205 * 206 * @param charset The new character set 207 */ 208 function setCharset( $charset ) 209 { 210 $this->_charset = $charset; 211 } 212 213 /** 214 * Retrieves the character set that was set for this message. Returns 215 * by default 'iso-8859-1' if no other has been set 216 * 217 *Ê@return the character set 218 */ 219 function getCharset() 220 { 221 return( $this->_charset ); 222 } 223 } 224 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 21:04:15 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |