NameSilo

Php form won't fwd email

Spacemail by SpaceshipSpacemail by Spaceship
Watch

bigtreble

Established Member
Impact
0
I want my email address [email protected] to forward to two other email address: [email protected], [email protected]

It works perfect via email.

But I have a php-form developed to send an email to #1...but #3 is never forwarded the message.

Am I forgetting something?
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Can you post the PHP?
 
0
•••
Dan Friedman said:
Can you post the PHP?

Thanks in advance.

I actually got the code from a NP post!...

<?php

//Start your PHP tags
foreach($_POST as $key => $val){
$$key = trim($val);
}
function em($ema){
if(!eregi('[a-z0-9]+[_a-z0-9-]*(\.[_a-z0-9-]+)*@[a-z?G0-9]+(-[a-z?G0-9]+)*(\.[a-z?G0-9-]+)*(\.[a-z]{2,4})$',
$ema, $ema_er)){
return 0;
} else {
return 1;
}
}
if(em($email) != 0){
$error = "<span class='error'>Error<br />The
email you entered is an invalid email address, Please input the correct email!</span>";
include("feedback.php");

exit();
}
if((!$name) || (!$email) || (!$comments)) {
$error = "<span class='error'><br /></span>";
include("feedback.php");
exit();
} else {
$ip = $_SERVER['REMOTE_ADDR'];
$ref = $_SERVER['HTTP_REFERER'];
$to = "[email protected]";
$date = date("m/d/Y");
$time = date("h:i:s A");
$subject = "My .com form has a message for you";
$msg = "Feedback from $username.
@ $email

Here are their comments:
$comments \n\n

Came from: $ref
At: $ip| $date | $time";
$mailheaders = "From: [email protected]<[email protected]> \n\r";
$mailheaders .= "X-Mailer: DP-Mail X-2 \n\r\n\r";
mail($to, $subject, $msg, $mailheaders);
$error = "<span class='true'>We have successfully sent your
contact form! </span>";
include("feedback.php");
exit();
} // Close PHP tags.
 
0
•••
try this one, you may or may not need to change the subject:
Code:
<?php
if ($comments)
{ 
	
	$emess = "This is what the person said\n\n";
	$emess.= "-------------------------------------------------\n\n\n";
	$emess.= "Comments:\n $comments\n\n";
	$emess.= "Contact Info:\n $name\n";
	$ehead= "$email\r\n";
	$subj = "Contact Form";
	$mailsend=mail("[email protected]","$subj","$emess","$ehead");
	
	echo "Thanks for the email.<br>";
	echo "I'll get back to you as soon as I can using the email you provided.";
}
else
{ 
  

	echo "<b>Contact Me</b><br><br>";
	echo '<form method="post" action="'.$PHP_SELF.'"> ';
	
	echo 'Name: <br>';
	echo '<input type="text" name="name"><br><br>';
	
	echo 'Contact Email: <br>';
	echo '<input type="text" name="email"><br><br>';
	
	echo 'Message: <br>';
	echo '<textarea name="comments" rows="5" cols="30"></textarea><br><br>';
	
	echo '<br>';
	echo '<input type="submit" value="Contact Me!"><br>';
	echo '</form>';

}


?>
 
0
•••
0
•••
Dan- Thanks, I understand that part.

But what I'm trying to do is set up [email protected] to forward the email to the other 2 addresses. This allows the public/bots to only see @mydomain instead of @comcast.com and @hotmail.com.

Weblord. Thank you, trying it now.
 
0
•••
The bots can't see the PHP, so that part doesn't matter. ;)
 
0
•••
Good to know

WEBLORD IS THE MAN! Thank you sir, worked PERFECT.
 
Last edited:
0
•••
the forwarding part do that via email setiings not via script the script i gave above try it saving it as .php and then view source, it won't show up your email address to be harvested by spammers, meanwhile do the redirect to 2 other email addresses via your email settings on cpanel.
hth
bigtreble said:
Dan- Thanks, I understand that part.

But what I'm trying to do is set up [email protected] to forward the email to the other 2 addresses. This allows the public/bots to only see @mydomain instead of @comcast.com and @hotmail.com.

Weblord. Thank you, trying it now.
 
0
•••
Appraise.net

We're social

Unstoppable Domains
Domain Recover
DomainEasy — Zero Commission
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back