Problems with mail() working on server

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
dru_nasty
Forum Commoner
Posts: 81
Joined: Sat Sep 10, 2005 10:26 am

Problems with mail() working on server

Post by dru_nasty »

Hi, I'm having problems getting a very simple script working on an ISS server.

Code: Select all

<html> 
<head> 
<title></title> 
</head> 
<body> 
<?php 
if ($_POST['submit']=='Submit') 
{ 
$to = "email here"; 
$subject = "Testing PHP on Server"; 
$message = "Mail is working"; 
$header = 'From: email here ' . "\r\n"; 
if(mail($to,$subject,$message,$header)) 
{ 
echo "mail sent"; 
} 
else 
{ 
echo "mail NOT sent"; 
} 
} 
?> 

<form method="post" action="<?php $_SERVER['PHP_SELF'] ?>"> 
<input type="submit" value="Submit" name="submit"> 
</form> 

</body> 
</html>
It works fine when I test on my server but on the clients server I get the "mail NOT sent" echo.
They recently successfully installed PHP on the server and a page with the phpinfo() function successfully displays everything about php. I don't understand where to go from here.

I know sendmail works on their SMTP since their old site used contact forms via FrontPage.
SMTP is set to localhost,
smtp_port is set to 25 (which is what they use),
and sendmail_path is set to "no value"

I'm pretty sure all that should be okay, but I could be wrong.

Anyone have any ideas please?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Have you tried Swiftmailer? I can understand the reluctance, but it's simply a lot easier using d11wtq's package over trying to get mail() to work on your own.
dru_nasty
Forum Commoner
Posts: 81
Joined: Sat Sep 10, 2005 10:26 am

Post by dru_nasty »

No I haven't, I'll look into it. Does swiftmail use something different so as to avoid this problem?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

It supports a variety of connections from using mail() as a fallback, to SMTP and a few others I believe. (It's been a while..)
dru_nasty
Forum Commoner
Posts: 81
Joined: Sat Sep 10, 2005 10:26 am

Post by dru_nasty »

Thanks so much, I'll give it a shot :)
Post Reply