Form Mail sending to multiple emails

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
clutch77
Forum Newbie
Posts: 1
Joined: Tue Feb 02, 2010 10:20 am

Form Mail sending to multiple emails

Post by clutch77 »

Hi,
I have used this form code for the past couple of month and it seems to work fine but all of a sudden it stopped. Can someone help me to why this code is not sending any more? The code is on a Windows server that has PHP Version 5.2.6.

<?php
if(strstr($Email," ")) echo "<span>No spaces in your Email address please. Try again.</span>";
else {
$msg = "";
$msg = $msg."Name: ".$Name."\n";
$msg = $msg."Address 1: ".$Address1."\n";
$msg = $msg."Address 2: ".$Address2."\n";
$msg = $msg."City: ".$City."\n";
$msg = $msg."Postal Code: ".$PostalCode."\n";
$msg = $msg."Service: ".$Service."\n";
$msg = $msg."Area: ".$Area."\n";
$msg = $msg."Province: ".$Province."\n";
$msg = $msg."Day Phone: ".$DayPhone."\n";
$msg = $msg."Evening Phone: ".$EveningPhone."\n";
$msg = $msg."Email: ".$Email."\n";
$msg = $msg."Comments: ".$Comments."\n";
if(strstr($City,"alymer")) mail("alymer@bobbylawn.com", "Contact", $msg, "From: alymer@bobbylawn.com");
if(strstr($City,"beamsville")) mail("beamsville@bobbylawn.com", "Contact", $msg, "From: beamsville@bobbylawn.com");
if(strstr($City,"bowmanville")) mail("bowmanville@bobbylawn.com", "Contact", $msg, "From: bowmanville@bobbylawn.com");
if(strstr($City,"brantford")) mail("brantford@bobbylawn.com", "Contact", $msg, "From: brantford@bobbylawn.com");
if(strstr($City,"burlington")) mail("burlington@bobbylawn.com", "Contact", $msg, "From: burlington@bobbylawn.com");
if(strstr($City,"courtice")) mail("courtice@bobbylawn.com", "Contact", $msg, "From: courtice@bobbylawn.com");
if(strstr($City,"cambridge")) mail("cambridge@bobbylawn.com", "Contact", $msg, "From: cambridge@bobbylawn.com");
if(strstr($City,"chatham")) mail("chatham@bobbylawn.com", "Contact", $msg, "From: chatham@bobbylawn.com");
if(strstr($City,"grimsby")) mail("grimsby@bobbylawn.com", "Contact", $msg, "From: grimsby@bobbylawn.com");
if(strstr($City,"hamilton")) mail("hamilton@bobbylawn.com", "Contact", $msg, "From: hamilton@bobbylawn.com");
if(strstr($City,"kitchener")) mail("kitchener@bobbylawn.com", "Contact", $msg, "From: kitchener@bobbylawn.com");
if(strstr($City,"leamington")) mail("leamington@bobbylawn.com", "Contact", $msg, "From: leamington@bobbylawn.com");
if(strstr($City,"london")) mail("london@bobbylawn.com", "Contact", $msg, "From: dave@bobbylawn.com");
if(strstr($City,"oakville")) mail("oakville@bobbylawn.com", "Contact", $msg, "From: oakville@bobbylawn.com");
if(strstr($City,"oshawa")) mail("oshawa@bobbylawn.com", "Contact", $msg, "From: oshawa@bobbylawn.com");
if(strstr($City,"sarnia")) mail("sarnia@bobbylawn.com", "Contact", $msg, "From: sarnia@bobbylawn.com");
if(strstr($City,"strathroy")) mail("strathroy@bobbylawn.com", "Contact", $msg, "From: strathroy@bobbylawn.com");
if(strstr($City,"st. thomas")) mail("stthomas@bobbylawn.com", "Contact", $msg, "From: stthomas@bobbylawn.com");
if(strstr($City,"stoney creek")) mail("stoneycreek@bobbylawn.com", "Contact", $msg, "From: stoneycreek@bobbylawn.com");
if(strstr($City,"windsor")) mail("windsor@bobbylawn.com", "Contact", $msg, "From: windsor@bobbylawn.com");
if(strstr($City,"woodstock")) mail("woodstock@bobbylawn.com", "Contact", $msg, "From: woodstock@bobbylawn.com");
}
?>

Thanks!
rahulzatakia
Forum Commoner
Posts: 59
Joined: Fri Feb 05, 2010 12:01 am
Location: Ahmedabad

Re: Form Mail sending to multiple emails

Post by rahulzatakia »

Hi,
I don't find any error in the code.
But i don't like the structure of the code...
you should use if..else instead of only if statement..
You have not mention what error you are getting...
Post Reply