From ad43e637bd51b5b288856fee9a69da851ba07779 Mon Sep 17 00:00:00 2001
From: thomascube [@todo Add tests for IMAP and SMTP settings]
+Server: getprop('smtp_server', 'PHP mail()'); ?>Test SMTP settings
+
+
+Port: getprop('smtp_port'); ?>
+User: getprop('smtp_user', '(none)'); ?>
+Password: getprop('smtp_pass', '(none)'); ?>
+
';
+
+ if (preg_match('/^' . $RCI->email_pattern . '$/i', trim($_POST['_from'])) &&
+ preg_match('/^' . $RCI->email_pattern . '$/i', trim($_POST['_to']))) {
+
+ $recipients = trim($_POST['_to']);
+
+ $headers = array(
+ 'From' => trim($_POST['_from']),
+ 'To' => $recipients,
+ 'Subject' => 'Test message from RoundCube',
+ );
+
+ $body = 'This is a test to confirm that RoundCube can send email.';
+
+ $mail_object = new rc_mail_mime();
+ $send_headers = $mail_object->headers($headers);
+
+ $smtp_response = array();
+ $status = smtp_mail($headers['From'], $recipients,
+ ($foo = $mail_object->txtHeaders($send_headers)),
+ $body, $smtp_response);
+
+ if ($status) {
+ $RCI->pass('SMTP send');
+ }
+ else {
+ $RCI->fail('SMTP send', join('; ', $smtp_response));
+ }
+ }
+ else {
+ $RCI->fail('SMTP send', 'Invalid sender or recipient');
+ }
+}
+
+echo '
[@todo Add tests for IMAP settings]
-- cgit v1.2.3