Need help as a newbie I'm trying to create auto email everytime the users execute the button below. Please tell me what wrong with my mail.php file
[PHP]
<html>
<head>
<form action="mail.ph p" method="POST" enctype="multip art/form-data">
<input type="submit" value="mail now">
</p>
</form>
</body>
</html>
[/PHP]
Here's the PHP email (mail.php) and I don't know how to do it, but I know that my sql is just working fine.
[PHP]
<?php
# Connect to the database
$dbLink = mysql_connect(" localhost", "xxx", "xxxxxxxx")
or die("Error! Failed to connect to the MySQL server!");
mysql_select_db ("cmr", $dbLink)
or die("Error! Failed to select a database!");
#query
$query="
SELECT m.email, f.approval1
from filestorage f, members m
where f.approved='N'
and f.approval1=m.n ame
$result = @MYSQL_QUERY($q uery);
while ($row = mysql_fetch_arr ay ($result)) {
// HTML body
$body = "Hello <font size=\"4\">" . $row["full_name"] . "</font>, <p>";
$body .= "<i>Your</i> personal photograph to this message.<p>";
$body .= "Sincerely, <br>";
$body .= "PHPMailer List manager";
// Plain text body (for mail clients that cannot read HTML)
$text_body = "Hello " . $row["approval1"] . ", \n\n";
$text_body .= "Your personal photograph to this message.\n\n";
$text_body .= "Sincerely, \n";
$text_body .= "PHPMailer List manager";
$mail->Body = $body;
$mail->AltBody = $text_body;
$mail->AddAddress($ro w["email"], $row["approval1"]);
if(!$mail->Send())
echo "There has been a mail error sending to " . $row["email"] . "<br>";
// Clear all addresses and attachments for next loop
$mail->ClearAddresses ();
$mail->ClearAttachmen ts();
}
?>
[/PHP]
[PHP]
<html>
<head>
<form action="mail.ph p" method="POST" enctype="multip art/form-data">
<input type="submit" value="mail now">
</p>
</form>
</body>
</html>
[/PHP]
Here's the PHP email (mail.php) and I don't know how to do it, but I know that my sql is just working fine.
[PHP]
<?php
# Connect to the database
$dbLink = mysql_connect(" localhost", "xxx", "xxxxxxxx")
or die("Error! Failed to connect to the MySQL server!");
mysql_select_db ("cmr", $dbLink)
or die("Error! Failed to select a database!");
#query
$query="
SELECT m.email, f.approval1
from filestorage f, members m
where f.approved='N'
and f.approval1=m.n ame
$result = @MYSQL_QUERY($q uery);
while ($row = mysql_fetch_arr ay ($result)) {
// HTML body
$body = "Hello <font size=\"4\">" . $row["full_name"] . "</font>, <p>";
$body .= "<i>Your</i> personal photograph to this message.<p>";
$body .= "Sincerely, <br>";
$body .= "PHPMailer List manager";
// Plain text body (for mail clients that cannot read HTML)
$text_body = "Hello " . $row["approval1"] . ", \n\n";
$text_body .= "Your personal photograph to this message.\n\n";
$text_body .= "Sincerely, \n";
$text_body .= "PHPMailer List manager";
$mail->Body = $body;
$mail->AltBody = $text_body;
$mail->AddAddress($ro w["email"], $row["approval1"]);
if(!$mail->Send())
echo "There has been a mail error sending to " . $row["email"] . "<br>";
// Clear all addresses and attachments for next loop
$mail->ClearAddresses ();
$mail->ClearAttachmen ts();
}
?>
[/PHP]
Comment