Changeset 3262 for branches/2.0/include
- Timestamp:
- Apr 26, 2009, 8:36:17 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.0/include/class_smtp_mail.inc.php
r3260 r3262 74 74 } 75 75 76 function add_recipients(&$recipients, $headers, $type_header) 77 { 78 if (preg_match('/^\s*'.$type_header.'\s*:.*/mi', $headers, $matches) != 0) 79 { 80 $list = explode(',', $matches[0]); 81 foreach ($list as $email) 82 { 83 if (strpos($email, '<') !== false) 84 { 85 $email = preg_replace('/.*<(.*)>.*/i', '$1', $email); 86 } 87 $recipients[] = trim($email); 88 } 89 } 90 } 91 76 92 // Adaptation of pun_mail 77 93 function mail($to, $subject, $message, $headers = '') 78 94 { 79 95 $this->no_error = true; 80 81 $recipients = explode(',', $to);82 96 83 97 // Are we using port 25 or a custom port? … … 119 133 $this->server_parse('250'); 120 134 121 if ( preg_match('/^\s*to\s*:.*/mi', $headers) === 0)135 if ((preg_match('/^\s*to\s*:.*/mi', $headers) === 0) and !empty($to)) 122 136 { 123 $to_header = 'To:'.implode(',', array_map(create_function('$email','return "<".$email.">";'), $recipients));137 $to_header = 'To:'.implode(',', array_map(create_function('$email','return "<".$email.">";'), explode(',', $to))); 124 138 } 125 139 else … … 127 141 $to_header = ''; 128 142 } 143 144 if (!empty($to)) 145 { 146 $recipients = explode(',', $to); 147 } 148 else 149 { 150 $recipients = array(); 151 } 152 153 $this->add_recipients($recipients, $headers, 'Cc'); 154 $this->add_recipients($recipients, $headers, 'Bcc'); 129 155 130 156 @reset($recipients);
Note: See TracChangeset
for help on using the changeset viewer.