mail() works on localhost but not when uploaded

 
Post new topic   Reply to topic    Aprelium Forum Index -> PHP
View previous topic :: View next topic  
Author Message
spunk
-


Joined: 26 Jul 2006
Posts: 2

PostPosted: Wed Jul 26, 2006 5:59 pm    Post subject: mail() works on localhost but not when uploaded Reply with quote

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 View user's profile Send private message MSN Messenger
TRUSTAbyss
-


Joined: 29 Oct 2003
Posts: 3752
Location: USA, GA

PostPosted: Wed Jul 26, 2006 6:38 pm    Post subject: Reply with quote

That's because your server uses SMTP Authentication. You should use localhost
if your server is local with the web server.
Back to top View user's profile Send private message Visit poster's website
spunk
-


Joined: 26 Jul 2006
Posts: 2

PostPosted: Fri Jul 28, 2006 4:15 pm    Post subject: Reply with quote

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 View user's profile Send private message MSN Messenger
TRUSTAbyss
-


Joined: 29 Oct 2003
Posts: 3752
Location: USA, GA

PostPosted: Fri Jul 28, 2006 6:28 pm    Post subject: Reply with quote

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 View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> PHP All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group