예제 #1
0
파일: test.php 프로젝트: ehmedov/www
 $body = 'This is a test to confirm that RoundCube can send email.';
 $smtp_response = array();
 // send mail using configured SMTP server
 if ($RCI->getprop('smtp_server')) {
     $CONFIG = $RCI->config;
     if (!empty($_POST['_smtp_user'])) {
         $CONFIG['smtp_user'] = $_POST['_smtp_user'];
     }
     if (!empty($_POST['_smtp_pass'])) {
         $CONFIG['smtp_pass'] = $_POST['_smtp_pass'];
     }
     $mail_object = new rcube_mail_mime();
     $send_headers = $mail_object->headers($headers);
     $SMTP = new rcube_smtp();
     $SMTP->connect();
     $status = $SMTP->send_mail($headers['From'], $headers['To'], $foo = $mail_object->txtHeaders($send_headers), $body);
     $smtp_response = $SMTP->get_response();
 } else {
     // use mail()
     $header_str = 'From: ' . $headers['From'];
     if (ini_get('safe_mode')) {
         $status = mail($headers['To'], $headers['Subject'], $body, $header_str);
     } else {
         $status = mail($headers['To'], $headers['Subject'], $body, $header_str, '-f' . $headers['From']);
     }
     if (!$status) {
         $smtp_response[] = 'Mail delivery with mail() failed. Check your error logs for details';
     }
 }
 if ($status) {
     $RCI->pass('SMTP send');