I am trying to get the mail function to work but i am getting this error and not sure how to fix it:

[error] PHP Warning: mail(): SMTP server response: 550 smtp authentication required.

If you need any additional information, just let me know what. TIA.

Wanted420

EDIT:
I just thought it would be nice if i showed yall some code 🙂 hehe.

$to = "blah@server.com";  
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: [email]wanted@test.com[/email]\r\n";
$mail = @mail($to,'Test','this is the body',$headers); // The "@" sign before the mail() call suppresses printing of errors // that may occur. The test below will check for errors instead: if(!$mail){
echo "Email not sent! Please try later...";
}else{
echo '<font color="#FFFFFF"><h3><tt>Thank You for registering ' . $username . '!<br>I have sent you a Welcome e-mail.';

    I belive this is a problem with the smtp server your using, and has nothing to do with php.
    Do you run your own smtp server, or use your ISP´s ?
    Most ISP´s restrict access to prevent spam, so if there outgoing mail server cannot verify who you are it will not allow you to send mail.

      I am running the server from my local machine. using hmailserver.

        i presume that in php.ini under SMTP you have localhost try and change that to your ISP´s smtp server, then php would use that.

        Or if you really want to use your mail server, configure it to relay on your ISP´s smtp server.

          I have tried localhost and my domain. If i use squirrellmail, i can read and send just fine. same with outlook. Is it looking for a username and password? I just want to know what causes the 550 erro.

          [mail function]
          ; For Win32 only.
          SMTP = mail.bitphire.com 
          
          ; For Win32 only
          smtp_port = 25
          
          ; For Win32 only.
          sendmail_from = [email]poop@bitphire.com[/email]
          

            You can try and use the socket method for authentication on the SMTP server - either that or look at the pear mail function...

            This is my take on the socketmail function...

            function socketmail($fromName, $fromAddress, $toArray, $subject, $message) {
            	ini_set("sendmail_from", $fromAddress);
            	$handle = pfsockopen ("127.0.0.1",25, $errno, $errstr, 30) or die("Could not talk to the sendmail server!<br/>$errno<br/>$errstr");
            	$rcv = fgets($handle, 1024); 
            	fputs($handle, "HELO {$_SERVER['SERVER_NAME']}\r\n");
            	$rcv = fgets($handle, 1024);
            	while (list($toKey, $toValue) = each($toArray)) {
            		fputs($handle, "MAIL FROM:$fromAddress\r\n");
            		$rcv = fgets($handle, 1024); 
            		fputs($handle, "RCPT TO:$toValue\r\n");
            		$rcv = fgets($handle, 1024); 
            		fputs($handle, "DATA\r\n");
            		$rcv = fgets($handle, 1024); 
            		fputs($handle, "Subject: $subject\r\n");
            		fputs($handle, "From: $fromName <$fromAddress>\r\n");
            		fputs($handle, "To: $toKey  <$toValue>\r\n");
            		fputs($handle, "X-Sender: <$fromAddress>\r\n");
            		fputs($handle, "Return-Path: <$fromAddress>\r\n");
            		fputs($handle, "Errors-To: <$fromAddress>\r\n");
            		fputs($handle, "X-Mailer: PHP - SocketMail\r\n");
            		fputs($handle, "X-Priority: 3\r\n");
            		fputs($handle, "Content-Type: multipart/alternative;\r\n");
            		fputs($handle, "        boundary=\"----=_NextPart_000_000A_01C3EE3F.867B1730\"\r\n");
            		fputs($handle, "\r\n");
            		fputs($handle, "This is a multi-part message in MIME format.\r\n");
            		fputs($handle, "\r\n");
            		fputs($handle, "------=_NextPart_000_000A_01C3EE3F.867B1730\r\n");
            		fputs($handle, "Content-Type: text/plain;\r\n");
            		fputs($handle, "        charset=\"ISO 8859-1\"\r\n");
            		fputs($handle, "Content-Transfer-Encoding: base64\r\n");
            		fputs($handle, "\r\n");
            		fputs($handle, chunk_split(base64_encode($message)) . "\r\n");
            		fputs($handle, "\r\n");
            		fputs($handle, "------=_NextPart_000_000A_01C3EE3F.867B1730\r\n");
            		fputs($handle, "Content-Type: text/html;\r\n");
            		fputs($handle, "        charset=\"ISO 8859-1\"\r\n");
            		fputs($handle, "Content-Transfer-Encoding: base64\r\n");
            		fputs($handle, "\r\n");
            		fputs($handle, chunk_split(base64_encode($message)) . "\r\n");
            		fputs($handle, "\r\n");
            		fputs($handle, "------=_NextPart_000_000A_01C3EE3F.867B1730--\r\n");
            		fputs($handle, "\r\n");
            		fputs($handle, ".\r\n");
            		$rcv = fgets($handle, 1024);
            		if (trim($rcv)=='250 OK')
            		{
            			return true;
            		}
            		else
            		{
            			return false;
            		}
            		fputs($handle, "RSET\r\n");
            		$rcv = fgets($handle, 1024); 
            	}
            	fputs ($handle, "QUIT\r\n");
            	$rcv = fgets ($handle, 1024); 
            	//echo("$rcv<br>");
            	fclose($handle);
            	ini_restore("sendmail_from");
            }
            

            One goo dway of testing is to telnet onto the SMTP server and try and send a mail that way.

              Write a Reply...