Space for google add

Write a PHP script to design a form to sending an email to more than one recipient.



 Write a PHP script to design a form to sending an email to more than

one recipient.


seta2email.html

<html>

        <form action="seta2email.php" method="POST">

TO<input type="email" name="to"multiple><br>

SUBJECT<input type="text" name="subject"><br>

MESSAGE<input type="text" name="message"><br>

FROM<input type="email" name="from"><br>

<input type="submit" name="submit" value="submit">

      </form>

</html>




seta2email.php

<?php

$to=$_POST['to'];

$from=$_POST['from'];

$subject=$_POST['subject'];

$message=$_POST['message'];

//$mail=mail($to,$subject,$message,$header);

$r=explode(",",$to);

$cnt=count($r);

for($i=0;$i<$cnt;$i++)

{

$mail=mail($r[$i],$subject,$message,$from);

if($to==null && $from==null)

{

echo "TO AND FROM FIELDS CANNOT BE NULL";

}

else if($message==null)

{

echo "MESSAGE CANNOT BE NULL";

}

else if($mail)

{

echo "mail send successfully to $r[$i]<br><br>";

}

else

echo "unable to send the mail to $r[$i]<br><br>";

}

}

?>


Post a Comment

0 Comments