View previous topic :: View next topic |
Author |
Message |
spunk -
Joined: 26 Jul 2006 Posts: 2
|
Posted: Wed Jul 26, 2006 5:59 pm Post subject: mail() works on localhost but not when uploaded |
|
|
I am trying to create a form that uses the mail() function to send the form variables to my email. I works great on my local host but when I uploaded it to my server it will not send.
Code: |
$Fname = stripslashes($_POST['FirstName']);
$Lname = stripslashes($_POST['LastName']);
$from = "$Fname $Lname";
$recipient = "mcglynn@aserty.com";
$subject = "Service Request";
$msg = "Message sent by $from\n";
$msg.="\nAddress: ".$_POST['Address'];
$msg.="\nCity: ".$_POST['City'];
$msg.="\nProvince: ".$_POST['Province'];
$msg.="\nPostalCode: ".$_POST['PostalCode'];
$msg.="\nTelephone: ".$_POST['Telephone'];
switch($_POST['Service']){
case 'ADSL_Standard':
$msg.="\nI would like to sign up for: ADSL Standard ";
break;
case 'ADSL_Premium':
$msg.="\nI would like to sign up for: ADSL Premium ";
break;
case 'ADSL_Standard_dry_loop':
$msg.="\nI would like to sign up for: ADSL Standard Dry Loop";
break;
case 'ADSL_Premium_dry_loop':
$msg.="\nI would like to sign up for: ADSL Premium Dry Loop";
break;
case 'Unlimited Dial-Up':
$msg.="\nI would like to sign up for: Unlimited Dial-Up";
break;
case 'Student Unlimited Dial-Up':
$msg.="\nI would like to sign up for: Student Unlimited Dial-Up";
break;
case 'Snowbird Unlimited Dial-Up':
$msg.="\nI would like to sign up for: Snowbird Unlimited Dial-Up";
break;
case 'Connected Minutes Dial-Up':
$msg.="\nI would like to sign up for: Connected Minutes Dial-Up";
break;
}
$options=$_POST['options'];
if (mail($recipient,$subject,$msg)){
echo "<p>Thanks for your order!</p>";
echo nl2br($msg);
} else
echo "An unknown error occurred.";
}
}
|
|
|
Back to top |
|
 |
TRUSTAbyss -
Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
|
Posted: Wed Jul 26, 2006 6:38 pm Post subject: |
|
|
That's because your server uses SMTP Authentication. You should use localhost
if your server is local with the web server. |
|
Back to top |
|
 |
spunk -
Joined: 26 Jul 2006 Posts: 2
|
Posted: Fri Jul 28, 2006 4:15 pm Post subject: |
|
|
My testing server is through localhost and it works great. When I upload to an external server I get "An unknown error occurred".
I've been looking for a site that explains how the mail() function interacts with the server. any ideas.
I don't know much about STMP but would like to learn. |
|
Back to top |
|
 |
TRUSTAbyss -
Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
|
Posted: Fri Jul 28, 2006 6:28 pm Post subject: |
|
|
When you upload the script to an external server, I don't think the mail()
function will work unless the external server is configured for localhost. You
should contact your web host to see if they can help you. |
|
Back to top |
|
 |
|