[advanced search]
 

Go Back   NamePros.com > Discussion > Web Design & Development > Programming

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


Closed Thread
 
LinkBack Thread Tools
Old 05-19-2006, 04:47 PM   #1 (permalink)
NamePros Member
 
Join Date: Dec 2005
Posts: 40
10.00 NP$ (Donate)

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, 04:52 PM   #2 (permalink)
Dan
Buy my domains.
 
Dan's Avatar
 
Join Date: Feb 2006
Posts: 2,801
56.00 NP$ (Donate)

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, 05:03 PM   #3 (permalink)
NamePros Member
 
Join Date: Dec 2005
Posts: 40
10.00 NP$ (Donate)

bigtreble is an unknown quantity at this point


Quote:
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";
$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, 05:08 PM   #4 (permalink)
NamePros Legend
 
weblord's Avatar
 
Join Date: Dec 2005
Location: Philippines - www.Nabaza.com
Posts: 19,840
21,700.43 NP$ (Donate)

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>';

}


?>
weblord is offline  
Old 05-19-2006, 05:08 PM   #5 (permalink)
Dan
Buy my domains.
 
Dan's Avatar
 
Join Date: Feb 2006
Posts: 2,801
56.00 NP$ (Donate)

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, 05:15 PM   #6 (permalink)
NamePros Member
 
Join Date: Dec 2005
Posts: 40
10.00 NP$ (Donate)

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, 05:22 PM   #7 (permalink)
Dan
Buy my domains.
 
Dan's Avatar
 
Join Date: Feb 2006
Posts: 2,801
56.00 NP$ (Donate)

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, 05:26 PM   #8 (permalink)
NamePros Member
 
Join Date: Dec 2005
Posts: 40
10.00 NP$ (Donate)

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 05:38 PM.
bigtreble is offline  
Old 05-19-2006, 07:22 PM   #9 (permalink)
NamePros Legend
 
weblord's Avatar
 
Join Date: Dec 2005
Location: Philippines - www.Nabaza.com
Posts: 19,840
21,700.43 NP$ (Donate)

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
Quote:
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.
weblord is offline  
Closed Thread


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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Site Sponsors
Advertise your business at NamePros

All times are GMT -7. The time now is 06:03 AM.


Powered by: vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0
Template-Modifications by TMS
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85