简体   繁体   中英

PHP Mail Function Not Working

I'm having some problems with a php mail function I'm trying to implement..

Originally my code was inserting the variables into a database on submit but now I'm trying to swap the code so it gets emailed instead..

The code is as follows.. It doesn't seem to want to work though, any suggestions will be a great help!

Thanks

This is the email function

$email = "xxx@xxx.com"
mail($email, $msg, "From: xxxxx \nX-Mailer:PHP/" . phpversion());
header("Location: index.php?act=topic&id=".$advert_id);

and this is the form its just submitted from

echo "<form method=\"post\" action=\"./index.php?act=reply&id=".$row['id']."\">";
echo "<tr><td><textarea style=\"width:90%\" name=\"reply\"></textarea><br><input type=\"submit\" name=\"submit\" value=\"Send Message\" style=\"width:90%\"></td></tr>";
echo "</table>";

You're missing a ; at the end of $email = "xxx@example.com"

You also haven't declared $msg , but perhaps you've done so elsewhere.

If this is PHP running on Windows then you might be encountering this problem:

php mail() function and IIS

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM