Very simple PHP email code works on 1 server, not the other

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Lawrence89
Forum Newbie
Posts: 1
Joined: Thu Jan 31, 2008 12:47 pm

Very simple PHP email code works on 1 server, not the other

Post by Lawrence89 »

I am working on a popcap game at my internship. The game uses the popcap HTTPTransfer class to send up a URL with all the necessary datafields to the script,
something like "www.gamesite.com?email=email@gmail.com&..." etc.

My script is:
<html>
<body>
<?php
if (isset($_REQUEST['email']))
{
//send email
$email = $_REQUEST['email'] ;
$emailfrom = $_REQUEST['emailfrom'];
$subject = $_REQUEST['subject'] ;
$message = $_REQUEST['message'] ;
mail( $email, "Subject: $subject",
$message, "From: $emailfrom" );
echo "Thank you for using our mail form";
}
else
//if "email" is not filled out, display the form
{
echo "<form method='post' action='mailform.php'>
Email: <input name='email' type='text' /><br />
Subject: <input name='subject' type='text' /><br />
Message:<br />
<textarea name='message' rows='15' cols='40'>
</textarea><br />
<input type='submit' />
</form>";
}
?>
</body>
</html>

It works fine from my personal server, where I was running it while waiting for the boss to give me the game's website login info. However, when I switched it over to the game's server, it doesn't work. Originally, this was because PHP wasn't installed there. Now, PHP is installed, but it still will not send an email. My coworker suggested it has to do with SMTP, but there is nothing SMTP specific in the script.

Could someone point me in the right direction? It would be greatly appreciated.
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Re: Very simple PHP email code works on 1 server, not the other

Post by JAM »

Welcome,
First: viewtopic.php?t=21171

I think you could find more there, as this likely is what he was talking about; http://se.php.net/manual/en/ref.mail.php
The php settings on the server might need tweaking abit.
Post Reply