I am trying to send mail to my local mail server. I am using hMailServer as mail server and I have configured it as mentioned here:
Setting up local Mail (SMTP, POP3, IMAP) Server on XAMPP
But when I try to send mail I am getting this error:
( ! ) Warning: mail() [function.mail]: SMTP server response: 550 The address is not valid. in C:\wamp\www\kariyersitem\register.php on line 161
Log files of the mail server indicates this error as below:
"DEBUG" 3108 "2012-01-08 18:04:24.447" "Creating session 14"
"SMTPD" 3108 14 "2012-01-08 18:04:24.448" "127.0.0.1" "SENT: 220 localhost ESMTP"
"SMTPD" 1728 14 "2012-01-08 18:04:24.454" "127.0.0.1" "RECEIVED: HELO olcay-pc"
"SMTPD" 1728 14 "2012-01-08 18:04:24.455" "127.0.0.1" "SENT: 250 Hello."
"SMTPD" 3108 14 "2012-01-08 18:04:24.457" "127.0.0.1" "RECEIVED: MAIL FROM:<you@yourdomain>"
"SMTPD" 3108 14 "2012-01-08 18:04:24.458" "127.0.0.1" "SENT: 550 The address is not valid."
"SMTPD" 2040 14 "2012-01-08 18:04:24.459" "127.0.0.1" "RECEIVED: QUIT"
"SMTPD" 2040 14 "2012-01-08 18:04:24.460" "127.0.0.1" "SENT: 221 goodbye"
"DEBUG" 3392 "2012-01-08 18:04:24.461" "Closing TCP/IP socket"
"DEBUG" 3392 "2012-01-08 18:04:24.462" "Ending session 14"
I have checked address and I am sure it is correct.
Can anyone tell me what is the problem?
Here my mail code:
$to = $frm_kadi;
$subject = $site_title.' Üyelik Aktivasyonu';
$message = 'hello';
$headers = 'From: '.$contact."\r\n".'Reply-To: '.$contact."\r\n".'X-Mailer: PHP/'.phpversion();
$mresult = mail($to, $subject, $message, $headers);
I have checked $contact
and It is written as olcayertas@gmail.com
in my config.php
file. Before sending mail I have use echo function to debug my code and it is correct.
Currently my $contact variable is set to:
$contact = "olcayertas@gmail.com";
UPDATE 1
Setting sendmail_from
to olcayertas@gmail.com
in php.ini
as @Jared Farrish suggested solved the first problem. But now I have a new problem:
"DEBUG" 3108 "2012-01-08 22:15:28.497" "Creating session 24"
"SMTPD" 3108 24 "2012-01-08 22:15:28.498" "127.0.0.1" "SENT: 220 localhost ESMTP"
"SMTPD" 3108 24 "2012-01-08 22:15:28.499" "127.0.0.1" "RECEIVED: HELO olcay-pc"
"SMTPD" 3108 24 "2012-01-08 22:15:28.500" "127.0.0.1" "SENT: 250 Hello."
"SMTPD" 4380 24 "2012-01-08 22:15:28.511" "127.0.0.1" "RECEIVED: MAIL FROM:<olcayertas@gmail.com>"
"DEBUG" 4380 "2012-01-08 22:15:28.542" "Total spam score: 0"
"SMTPD" 4380 24 "2012-01-08 22:15:28.547" "127.0.0.1" "SENT: 250 OK"
"SMTPD" 3108 24 "2012-01-08 22:15:28.548" "127.0.0.1" "RECEIVED: RCPT TO:<olcayertas>"
"SMTPD" 3108 24 "2012-01-08 22:15:28.548" "127.0.0.1" "SENT: 550 A valid address is required."
"SMTPD" 2040 24 "2012-01-08 22:15:28.552" "127.0.0.1" "RECEIVED: QUIT"
"DEBUG" 2040 "2012-01-08 22:15:28.552" "Deleting message file"
"SMTPD" 2040 24 "2012-01-08 22:15:28.552" "127.0.0.1" "SENT: 221 goodbye"
"DEBUG" 4380 "2012-01-08 22:15:28.555" "Closing TCP/IP socket"
"DEBUG" 4380 "2012-01-08 22:15:28.556" "Ending session 24"
It seems like it does not get destination address completely. I am trying to send mail to myself but it gets only username olcayertas
and missing domain @gmail.com
.
UPDATE 2
I have solved the second problem. It was my mistake.
UPDATE 3
Now I am getting this error:
"SENT: 530 SMTP authentication is required."
But I have already filled SMTP authentication settings under Settings->Ptotocols->SMTP->Delivery of e-mail->SMTP Relayer
. Server requires authentication
and Use SSL
otions checked.
UPDATE 4
Disabling Require SMPTP authentication
options of hMailServer in Settings->Advanced->IP Ranges->My Compter
solved SMTP authentication problem.