Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Thu Dec 04, 2008 2:43 pm 
Offline
Senior Member

Joined: Sun Nov 30, 2008 3:40 pm
Posts: 109
What I'm trying to do is to simply make the mail() function of PHP work flawlessly.

I've installed sendmail with
Code:
apt-get install sendmail

It installed without any problems and auto-configured everything.

The weirdness starts here. I've created a simple php file to test it.

The contents are as follows:
Code:
<?php
$to ='me@example.com';
$subject = 'Hi!';
$message = 'Sample Message';
$headers = 'From : you@somedomain.com'."\r\n".
'Reply-To: someone@somedomain.com';

if (mail($to,$subject,$message,$headers)) {
print "Success!";
}else{
print "Failed :(";
}

?>


Now, the mail successfully arrives at the destination, no problem there. But the php script never gets terminated. It just keeps running and running until the process is automatically killed. Then the page displays a "500 Internal Server Error".

I do know a few things about sendmail, but never encountered an error like this before. Any ideas? Thanks!


Top
   
 Post subject:
PostPosted: Thu Dec 04, 2008 4:35 pm 
Offline
Senior Member

Joined: Sun Nov 30, 2008 3:40 pm
Posts: 109
I've found the solution and I'm writing it here for future reference.

The problem was that I haven't set an FQDN (Fully Qualified Domain Name) in /etc/hosts. The file's first two lines were like this:
Code:
127.0.0.1 localhost
127.0.0.1 [your host name]


I've changed it to this:
Code:
127.0.0.1 localhost localhost.localdomain [your host name]
127.0.0.1 [your host name]


Then I've executed sendmailconfig and voila! Everything worked flawlessly!


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 2 guests


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

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group