NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page php form wont fwd email

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 05-19-2006, 05:47 PM THREAD STARTER               #1 (permalink)
NamePros Member
Join Date: Dec 2005
Posts: 40
bigtreble is an unknown quantity at this point
 



php form wont fwd email


I want my email address 1@mydomain.com to forward to two other email address: 2@google.com, 3@comcast.net

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?
bigtreble is offline  
Old 05-19-2006, 05:52 PM   #2 (permalink)
Dan
Buy my domains.
 
Dan's Avatar
Join Date: Feb 2006
Posts: 2,796
Dan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant future
 


Autism Autism Autism Autism Autism Autism Autism
Can you post the PHP?
Dan is offline  
Old 05-19-2006, 06:03 PM THREAD STARTER               #3 (permalink)
NamePros Member
Join Date: Dec 2005
Posts: 40
bigtreble is an unknown quantity at this point
 



Originally Posted by Dan Friedman
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 = "1@mydomain.com";
$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: 1@mydomain.com<1@mydomain.com> \n\r";
????: NamePros.com http://www.namepros.com/programming/199071-php-form-wont-fwd-email.html
$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.
bigtreble is offline  
Old 05-19-2006, 06:08 PM   #4 (permalink)
NamePros Legend
 
weblord's Avatar
Join Date: Dec 2005
Location: Philippines - www.Nabaza.com
Posts: 19,785
weblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatness
 


Autism Protect Our Planet
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("1@mydomain.com","$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>';

}


?>
__________________
Nabaza.com - Amaia
weblord is offline  
Old 05-19-2006, 06:08 PM   #5 (permalink)
Dan
Buy my domains.
 
Dan's Avatar
Join Date: Feb 2006
Posts: 2,796
Dan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant future
 


Autism Autism Autism Autism Autism Autism Autism
The reason it only goes to 1@yourdomain.com is because the line that says where it goes to.

$to = "1@mydomain.com";

It can't magically know where else you want it to go.

Change the above line to:

$to = "1@mydomain.com, 2@mydomain.com, 3@mydomain.com";
Dan is offline  
Old 05-19-2006, 06:15 PM THREAD STARTER               #6 (permalink)
NamePros Member
Join Date: Dec 2005
Posts: 40
bigtreble is an unknown quantity at this point
 



Dan- Thanks, I understand that part.

But what I'm trying to do is set up 1@mydomain.com 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.
bigtreble is offline  
Old 05-19-2006, 06:22 PM   #7 (permalink)
Dan
Buy my domains.
 
Dan's Avatar
Join Date: Feb 2006
Posts: 2,796
Dan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant futureDan has a brilliant future
 


Autism Autism Autism Autism Autism Autism Autism
The bots can't see the PHP, so that part doesn't matter.
Dan is offline  
Old 05-19-2006, 06:26 PM THREAD STARTER               #8 (permalink)
NamePros Member
Join Date: Dec 2005
Posts: 40
bigtreble is an unknown quantity at this point
 



Good to know

WEBLORD IS THE MAN! Thank you sir, worked PERFECT.
Last edited by bigtreble; 05-19-2006 at 06:38 PM.
bigtreble is offline  
Old 05-19-2006, 08:22 PM   #9 (permalink)
NamePros Legend
 
weblord's Avatar
Join Date: Dec 2005
Location: Philippines - www.Nabaza.com
Posts: 19,785
weblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatnessweblord Has achieved greatness
 


Autism Protect Our Planet
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
Originally Posted by bigtreble
Dan- Thanks, I understand that part.

But what I'm trying to do is set up 1@mydomain.com 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.
__________________
Nabaza.com - Amaia
weblord is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Liquid Web Smart Servers  
All times are GMT -7. The time now is 10:04 PM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger