Changeset 1147 in subversion for trunk/roundcubemail/installer/test.php
- Timestamp:
- Feb 27, 2008 9:23:41 AM (5 years ago)
- File:
-
- 1 edited
-
trunk/roundcubemail/installer/test.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/roundcubemail/installer/test.php
r1144 r1147 3 3 <h3>Check config files</h3> 4 4 <?php 5 6 require_once 'include/rcube_html.inc'; 5 7 6 8 $read_main = is_readable('../config/main.inc.php'); … … 126 128 Server: <?php echo $RCI->getprop('smtp_server', 'PHP mail()'); ?><br /> 127 129 Port: <?php echo $RCI->getprop('smtp_port'); ?><br /> 128 User: <?php echo $RCI->getprop('smtp_user', '(none)'); ?><br /> 129 Password: <?php echo $RCI->getprop('smtp_pass', '(none)'); ?><br /> 130 131 <?php 132 133 if ($RCI->getprop('smtp_server')) { 134 $user = $RCI->getprop('smtp_user', '(none)'); 135 $pass = $RCI->getprop('smtp_pass', '(none)'); 136 137 if ($user == '%u') { 138 $user_field = new textfield(array('name' => '_user')); 139 $user = $user_field->show(); 140 } 141 if ($pass == '%p') { 142 $pass_field = new passwordfield(array('name' => '_pass')); 143 $pass = $pass_field->show(); 144 } 145 146 echo "User: $user<br />"; 147 echo "Password: $pass<br />"; 148 } 149 150 ?> 130 151 </p> 131 152 … … 142 163 preg_match('/^' . $RCI->email_pattern . '$/i', trim($_POST['_to']))) { 143 164 144 $recipients = trim($_POST['_to']);145 146 165 $headers = array( 147 166 'From' => trim($_POST['_from']), 148 'To' => $recipients,167 'To' => trim($_POST['_to']), 149 168 'Subject' => 'Test message from RoundCube', 150 169 ); 151 170 152 171 $body = 'This is a test to confirm that RoundCube can send email.'; 153 154 $mail_object = new rc_mail_mime();155 $send_headers = $mail_object->headers($headers);156 157 172 $smtp_response = array(); 158 $status = smtp_mail($headers['From'], $recipients, 159 ($foo = $mail_object->txtHeaders($send_headers)), 160 $body, $smtp_response); 173 174 // send mail using configured SMTP server 175 if ($RCI->getprop('smtp_server')) { 176 $CONFIG = $RCI->config; 177 178 if (!empty($_POST['_user'])) 179 $CONFIG['smtp_user'] = $_POST['_user']; 180 if (!empty($_POST['_pass'])) 181 $CONFIG['smtp_pass'] = $_POST['_pass']; 182 183 $mail_object = new rc_mail_mime(); 184 $send_headers = $mail_object->headers($headers); 185 186 $status = smtp_mail($headers['From'], $headers['To'], 187 ($foo = $mail_object->txtHeaders($send_headers)), 188 $body, $smtp_response); 189 } 190 else { // use mail() 191 $header_str = 'From: ' . $headers['From']; 192 193 if (ini_get('safe_mode')) 194 $status = mail($headers['To'], $headers['Subject'], $body, $header_str); 195 else 196 $status = mail($headers['To'], $headers['Subject'], $body, $header_str, '-f'.$headers['From']); 197 198 if (!$status) 199 $smtp_response[] = 'Mail delivery with mail() failed. Check your error logs for details'; 200 } 161 201 162 202 if ($status) {
Note: See TracChangeset
for help on using the changeset viewer.
