mail() issue

midoriblue

New member
Joined
Dec 14, 2004
Messages
1
Hi,

I need help with mail().. it doesn't seem to send email at all..

However, when I used the same scripts for another username / domain name, it works.

I read some of the threads on mail function in this forum, and I'm just wondering if it has anything to do with changing the server. The domain name that i use, used to point to our old server - which uses IIS, and now because I want to learn PHP , i point all the A records to our new server which supports PHP.

Sorry I'm new to this PHP/apache thing, so I will probably ask more questions later..


Thanks:(
 
The PHP's mail function varies from server to server, especially from IIS webserver to Apache. What errors are you getting? It's probably something to do with the last argument.
 
Same problem here on our new server. Appears to be working on the old server (freebsd/cpanel) but not on our new server (fedora/direct admin).

Seems like whole mail() function is disabled here (currently looking how to enable/fix this).

Jochem
 
XBL said:
Same problem here on our new server. Appears to be working on the old server (freebsd/cpanel) but not on our new server (fedora/direct admin).

Seems like whole mail() function is disabled here (currently looking how to enable/fix this).

Jochem
I highly doubt the mail function is disabled, unless you did it.

PHP must have access to the sendmail binary on your system during compile time. If you use another mail program, such as qmail or postfix, be sure to use the appropriate sendmail wrappers that come with them.

I wrote up some code and I want you to try it.

PHP:
<?php
//You must enter your email address!!
$to = "[email protected]";
if (function_exists('mail')) {
   echo "mail() function is available.<br />Test message has been sent to $to\n";
mail($to, "My Subject", "Mail does work!!\n\n\t$_SERVER[SERVER_NAME]\n", "From: [email protected]");
} else {
   echo "mail() function are NOT available.<br />";
}
?>
 
Last edited:
DJ_Max said:
I highly doubt the mail function is disabled, unless you did it.
Very true, but I didn't know what else it could be. I know now, not fixed yet, tho: Exim doesn't seem to send out mails at all.

I'm going to look into this further, can't help you with the mail()-prob, midoriblue, sorry.

Jochem
 
Please Help

Please Help!! I'm having the same problem and would love some help. I've got simple php code

Code:
			$to = [email][email protected][/email]';
			
			$subject = 'Sugar in the Raw Street Team Application';
			
			/* To send HTML mail, you can set the Content-type header. */
			$headers  = "MIME-Version: 1.0\r\n";
			$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
			$headers .= "From: Sugar in the Raw <$email>\r\n";

			$content = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">';
			$content .= '<html>';
			$content .= '<head>';
			$content .= '<title>Street Team Sign Up Form</title>';
			$content .= '<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">';
			$content .= '</head>';
			$content .= '<body>';
			$content .= 'This is an automated notice that a user would like to apply to be a Street Team Member.  The users information is listed bellow.<br><br>';
			$content .= '<table><tr><td colspan="2">User Information</td></tr>';
			$content .= '<tr><td>Name</td><td>'.$name.'</td></tr>';
			if ($address) {
				$content .= '<tr><td>Address</td><td>'.$address.'</td></tr>';
			}
			$content .= '<tr><td>City</td><td>'.$city.'</td></tr>';
			$content .= '<tr><td>State</td><td>'.$state.'</td></tr>';
			$content .= '<tr><td>Phone</td><td>'.$phone.'</td></tr>';
			$content .= '<tr><td>Email</td><td>'.$email.'</td></tr>';
			$content .= '<tr><td colspan="2"></td></tr>';
			if ($age) {
				$content .= '<tr><td>Age</td><td>'.$age.'</td></tr>';
				$content .= '<tr><td colspan="2"></td></tr>';
			}
			if ($favorite) {
				$content .= '<tr><td colspan="2">Favorite Bands</td></tr>';
				$content .= '<tr><td colspan="2">'.$favorite.'</td></tr>';
			}
			if ($shows) {
				$content .= '<tr><td colspan="2">Recent Shows</td></tr>';
				$content .= '<tr><td colspan="2">'.$shows.'</td></tr>';
			}
			$content .= '</table>';
			$content .= '</body>';
			$content .= '</html>';
			if (mail($to, $subject, $content, $headers)) {
				echo "<center>Thank you for submitting, you should hear from us soon.</center>";
				$error = -1;
			}

It is working on a debian server (no control panel), but not on my new freebsd server (running DirectAdmin). It runs through the code like it works but then it just never sends the email.

One post I read told me to check out my sendmail and this is what it is telling me

Code:
iProvInternal# ls -al /usr/sbin/sendmail
lrwxr-xr-x  1 root  wheel  4 Nov  6 01:33 /usr/sbin/sendmail -> exim


  • I don't know how to make sure sendmail is running. Do you know how to do that?
  • could there be a queue I should check?
  • how can I check to make sure it's resolving lookups correctly?

Any ideas would help.
 
Back
Top