• 12

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191


File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

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"   "" "SENT: 220 localhost ESMTP"  
"SMTPD" 1728    14  "2012-01-08 18:04:24.454"   "" "RECEIVED: HELO olcay-pc"  
"SMTPD" 1728    14  "2012-01-08 18:04:24.455"   "" "SENT: 250 Hello."  
"SMTPD" 3108    14  "2012-01-08 18:04:24.457"   "" "RECEIVED: MAIL FROM:<you@yourdomain>"  
"SMTPD" 3108    14  "2012-01-08 18:04:24.458"   "" "SENT: 550 The address is not valid."  
"SMTPD" 2040    14  "2012-01-08 18:04:24.459"   "" "RECEIVED: QUIT"  
"SMTPD" 2040    14  "2012-01-08 18:04:24.460"   "" "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";


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"   "" "SENT: 220 localhost ESMTP"  
"SMTPD" 3108    24  "2012-01-08 22:15:28.499"   "" "RECEIVED: HELO olcay-pc"  
"SMTPD" 3108    24  "2012-01-08 22:15:28.500"   "" "SENT: 250 Hello."  
"SMTPD" 4380    24  "2012-01-08 22:15:28.511"   "" "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"   "" "SENT: 250 OK"  
"SMTPD" 3108    24  "2012-01-08 22:15:28.548"   "" "RECEIVED: RCPT TO:<olcayertas>"  
"SMTPD" 3108    24  "2012-01-08 22:15:28.548"   "" "SENT: 550 A valid address is required."  
"SMTPD" 2040    24  "2012-01-08 22:15:28.552"   "" "RECEIVED: QUIT"  
"DEBUG" 2040    "2012-01-08 22:15:28.552"   "Deleting message file"  
"SMTPD" 2040    24  "2012-01-08 22:15:28.552"   "" "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.


I have solved the second problem. It was my mistake.


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.


Disabling Require SMPTP authentication options of hMailServer in Settings->Advanced->IP Ranges->My Compter solved SMTP authentication problem.

To solve SENT: 550550 The address is not valid. problem, you have to set sendmail_from to a valid mail address in php.ini file.

To solve SENT: 530 SMTP authentication is required problem, open hMailServer Administrator. Go to Settings->Advanced->IP Ranges->My Compter. Disable all options under "Require SMTP authentication" section.

  • 12
Reply Report
      • 1
    • 530 SMTP authentication: It works but had to change Internet settings instead of Computer settings to be able to send emails from localhost to same domain of webserver. Had to uncheck "local to local e-mail adresses" in Require SMTP authentication". Default sender in my php.ini is admin@webserv.com. It enables me to send emails to, for example: notify@webserv.com.

You're using you@yourdomain as the From address and the server rejects it.
Use a real address instead.

  • 1
Reply Report
      • 2
    • I have checked it. 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.
      • 2
    • OK, but there are two From addresses when sending a message: there is the From of the headers which is not used by SMTP, and the From of the envelope which is used by SMTP in the MAIL FROM command. This is the latter one that is giving you trouble. With sendmail, the envelope-From can be passed with the -f option. This kind of option can be passed to php mail() function in the additional_parameters argument.

KEEP IN MIND, every time, after You change php.ini,

you should restart wamp (! ! !)

to read the updated php.ini

p.s. you may need to use ini_set("sendmail_from", "your_user@gmail.com"); in your php script, before mail();

  • 0
Reply Report

Warm tip !!!

This article is reproduced from Stack Exchange / Stack Overflow, please click

Trending Tags

Related Questions