From 83233e7dc632061f78c8d8a390221fac044b4d25 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sat, 17 Mar 2007 15:52:02 +0000 Subject: [PATCH] r1468: In mailtest.php: - Check the validity of email addresses before sending - Make the sending from a non-existent address more effective and meaningful --- docs/mailtest.php | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/docs/mailtest.php b/docs/mailtest.php index 8efbbdd..fae9dc3 100644 --- a/docs/mailtest.php +++ b/docs/mailtest.php @@ -73,24 +73,30 @@ Sendmail (Path): \"" . ini_get('sendmail_path') . "\""; $mail->setFromName('Bugdar Mailing Test'); $mail->setSubject('Email Tests'); - // normal Bugdar mailing - $mail->setBodyText(sprintf($text, 1, 'sending with the Bugdar-configured address')); - $mail->send($bugsys->in['receive']); + if (empty($bugsys->in['receive']) OR empty($bugsys->in['sender']) OR !$funct->is_valid_email($bugsys->in['receive']) OR !$funct->is_valid_email($bugsys->in['sender'])) + { + echo '

You did not fill in all the fields or the email addresses are not valid. Please go back.

'; + } + else + { + // normal Bugdar mailing + $mail->setBodyText(sprintf($text, 1, 'sending with the Bugdar-configured address')); + $mail->send($bugsys->in['receive']); - // mail from the alternate address - $mail->setBodyText(sprintf($text, 2, 'sending from the address you specified that exists on the mail server')); - $mail->setFromAddress($bugsys->in['sender']); - $mail->send($bugsys->in['receive']); + // mail from the alternate address + $mail->setBodyText(sprintf($text, 2, 'sending from the address you specified that exists on the mail server')); + $mail->setFromAddress($bugsys->in['sender']); + $mail->send($bugsys->in['receive']); - // mail from self - $mail->setBodyText(sprintf($text, 3, 'sending from the receiving address')); - $mail->setFromAddress($bugsys->in['receive']); - $mail->send($bugsys->in['receive']); + // mail from self + $mail->setBodyText(sprintf($text, 3, 'sending from the receiving address')); + $mail->setFromAddress($bugsys->in['receive']); + $mail->send($bugsys->in['receive']); - // mail from non-existent - $mail->setBodyText(sprintf($text, 4, 'sending from a non-existent address')); - $mail->setFromAddress('bugdar-mail-test@bluestatic.org'); - $mail->send($bugsys->in['receive']); + // mail from non-existent + $mail->setBodyText(sprintf($text, 4, 'sending from a non-existent address')); + $mail->setFromAddress(preg_replace('#(.*)@(.*)#', 'bugdar-mail-test@\2', $bugsys->in['receive'])); + $mail->send($bugsys->in['receive']); ?> @@ -98,6 +104,7 @@ Sendmail (Path): \"" . ini_get('sendmail_path') . "\"";

All the test emails were sent to in['receive'] ?>. Please check that you received all 4 tests.

-- 2.43.5