how to verify an email address?
2 posts
Page 1 of 1
Hi everyone,
I’m looking to find out how to verify an email address...
I have a recommendation script on my site that works well if you enter an address like blou@blabla.com, but if I just enter blou, I get an error message that doesn’t display “nicely,” I would say :lol:
Here’s what it says:
For your information, here is my script:
I’m looking to find out how to verify an email address...
I have a recommendation script on my site that works well if you enter an address like blou@blabla.com, but if I just enter blou, I get an error message that doesn’t display “nicely,” I would say :lol:
Here’s what it says:
Code: Select all
So if someone could point me to a simple tutorial to fix this problem, I would really appreciate it!Warning: mail() [function.mail]: Invalid mail. to = [blou] in /mnt/128/sdb/2/c/blingbling/pages/rec.php on line 11
For your information, here is my script:
Code: Select all
So from what I have seen so far, it’s this:
<?php
if($_POST)
{
if(empty($_POST['nom']) OR empty($_POST['email']) OR empty($_POST['content']))
{
echo "<p>Please fill in all the fields.</p>";
}
else
{
mail($_POST['email'], stripslashes($_POST['nom'])." recommends a site to you", stripslashes($_POST['content']), "From: ".$_POST['email']."\nReply-To: ".$_POST['email']);
echo "<p>Your friend has been notified.</p>";
}
}
?><form action='<?php echo $PHP_SELF; ?>?page=rec' method='post'>
<fieldset>...etc</fieldset></form>
Code: Select all
!eregi("^[0-9a-z]([-_.]?[0-9a-z])*@[0-9a-z]([-.]?[0-9a-z])*\.[a-z]{2,4
Been to long since I've been on here. I made an example below with an email filter.
Documentation can be found here: https://www.php.net/manual/en/function.filter-var.php
Documentation can be found here: https://www.php.net/manual/en/function.filter-var.php
Code: Select all
<?php
if ($_POST) {
if (empty($_POST['nom']) || empty($_POST['email']) || empty($_POST['content'])) {
echo "<p>Please fill in all the fields.</p>";
} else {
if (!filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) {
echo "<p>Please enter a valid email address.</p>";
} else {
mail($_POST['email'], stripslashes($_POST['nom'])." recommends a site to you", stripslashes($_POST['content']), "From: ".$_POST['email']."\nReply-To: ".$_POST['email']);
echo "<p>Your friend has been notified.</p>";
}
}
}
?>
<form action='<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?>?page=rec' method='post'>
</form>
2 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023