hello everybody.. i just want to know what this error means... Error: mail() [function.mail]: SMTP server response: 501 #5.1.1 bad address
the smtp set up was correct.. valid emails... and port. so im just wondering why this error still occurs.
looking forward for your suggestions.. thanks!
9 13964
Hi bonski and welcome to TSDN,
If you take a look at the rfc defining SMTP codes here you will see the error you are getting described as: - 5.X.X Permanent Failure
-
-
A permanent failure is one which is not likely to be resolved by
-
resending the message in the current form. Some change to the
-
message or the destination must be made for successful delivery.
and - X.1.X Addressing Status
-
-
The address status reports on the originator or destination
-
address. It may include address syntax or validity. These
-
errors can generally be corrected by the sender and retried.
and - X.1.1 Bad destination mailbox address
-
-
The mailbox specified in the address does not exist. For
-
Internet mail names, this means the address portion to the
-
left of the "@" sign is invalid. This code is only useful
-
for permanent failures.
so it looks like the mailbox you are sending to is not correct...
Post the code doing the mail send, lets take a look at that..
Regards
Purple
thanks purple.. ok.. here are the codes..
the values are just for dummies.. ^__^ -
//generate_newletter.php
-
-
$firstname = 'firstname';
-
$lastname = 'lastname';
-
$sendlog_message = 'message here';
-
-
$receiver_name = $firstname." ".$lastname;
-
-
$receiver_email1='k_bonbon_h5@yahoo.com';
-
$receiver_email2='';
-
-
$sender_name = 'me';
-
$sender_email = 'me@ourdomain.com';
-
$Cc_email=$receiver_email2;
-
$Bcc_email="";
-
-
$subject = 'test';
-
-
//this line.. opens our mail template...
-
$message_arr = file('crm_template/sample.htm');
-
-
$msg = '';
-
foreach ($message_arr as $line_num => $line) {
-
while (preg_match("/(฿)([\w]+)/i", $line, $found_var)) { // loop when found "@" in that line ($line)
-
// ........(ß).....find the character when begin with "ß"
-
// .......([w]+)/i......(......) set of sub pattern
-
// .........................[\w] mean find word (can be combine of charactor +number)
-
// ..........................+ mean [w] can be more than one character
-
// ...........................i (after "/") mean to match with case-sensitive
-
$temp_var=$$found_var[2];
-
$line=ereg_replace($found_var[0],$temp_var,$line);
-
-
} // end while (preg_match (...
-
$msg.= $line;
-
}// end foreach
-
-
include('send_email.php');
-
-
-
the other page where na mail function is location.. here it is..
-
-
//send_email.php
-
-
$to = $sender_email;
-
-
$header = "From: \"".addslashes($sender_name)."\" <".$sender_email.">\r\n";
-
if (isset($Cc_email)){
-
$header .= "Cc: ".$Cc_email."\r\n";
-
}
-
if (isset($Bcc_email)){
-
$header .= "Bcc: ".$Bcc_email."\r\n";
-
}
-
-
$header .= "Reply-To: ".$to."\r\n";
-
$header .= "Content-Type: text/html; charset=TIS-620 \n";
-
$header .= "MIME-Version: 1.0 \r\n";
-
-
//in this line.. this is our smtp server... i dont know whats wrong with this.. but it works on outlook... ^__^
-
ini_set('SMTP','mail.asianet.co.th');
-
-
//so this is where the problem is...
-
if(mail("\"".$receiver_name."\" <".$receiver_email1.">", $subject, $msg, $header)){
-
echo 'SENT!!!!';
-
}else{
-
echo 'FAILED!!!!';
-
}
-
thanks.. just inform me if there's something not right with these codes...
Hi Bonski,
That was interesting.. I think there were a couple of issues in there.. one is still unresolved.. try this as a working half way house:
send_email.php
[PHP]<?php
//the other page where na mail function is location.. here it is..
//send_email.php
$to = $sender_email;
$header = "From: \"".addslashes($sender_name)."\" <".$sender_email.">\r\n";
if (isset($Cc_email) and $Cc_email <> ""){
$header .= "Cc: ".$Cc_email."\r\n";
}
if (isset($Bcc_email) and $Bcc_email <> ""){
$header .= "Bcc: ".$Bcc_email."\r\n";
}
$header .= "Reply-To: ".$to."\r\n";
$header .= "Content-Type: text/html; charset=TIS-620 \r\n";
$header .= "MIME-Version: 1.0 \r\n";
//in this line.. this is our smtp server... i dont know whats wrong with this.. but it works on outlook... ^__^
ini_set('SMTP','sbs-server');
echo "here =>".$receiver_email1."<= here";
echo "here =>".$header."<= here";
//so this is where the problem is...
//if(mail("\"".$receiver_name."\" <".$receiver_email1.">", $subject, $msg, $header)){
if (mail($receiver_email1.">", $subject, $msg, $header)) {
echo 'SENT!!!!';
}else{
echo 'FAILED!!!!';
}
?>[/PHP]
the headers were being malformed cause the isset check was passed but the variables were actually == ""
the name element prefix to the email address on the mail() function isn't working for me - I pass it back to you to have a play..
Let me know how you get on..
Regards Purple
ei purple..
ok.. i think the problem was not with the $header variable.. because it was just concatenating the values... ok.. here's why..
i tried to create another page... without too much variables..
//test_mail.php
[PHP]
$header = "From: kris <kristian@atpthailand.com>\r\n";
$header .= "Cc: skimmerboi@gmail.com\r\n";
$header .= "Bcc: \r\n";
$header .= "Reply-To: kristian@atpthailand.com\r\n";
$header .= "Content-Type: text/html; charset=TIS-620 \n";
$header .= "MIME-Version: 1.0 \r\n";
echo $header;//here i display the $header.. there nothing wrong..
ini_set('SMTP','mail.asianet.co.th');
if(mail("me <k_bonbon_h5@yahoo.com>", "test", "message here", $header)){
echo 'SENT!!!!';
}else{
echo 'FAILED!!!!';
}
[/PHP]
so i had this short code.. still the same result.. uhmmm.. about the code.. 5.x.x means permanent failure.. im just wondering if there's any alternative solution for that.. or.. what's the best solution with that?
thanks again purple..^___^
Hi,
I suggest you try changing:
[PHP]mail("me <k_bonbon_h5@yahoo.com>", "test", "message here", $header)[/PHP]
to
[PHP]mail("k_bonbon_h5@yahoo.com", "test", "message here", $header))[/PHP]
that will work
Purple
Hi,
I have done a little reading on this - even got a book out !!
It would appear some MTA's don't support extended address or are rstricted in what the will support - I suspect this is the issue we are experiencing with your to format.
Regards Purple
hahaha.. what a crazy afternoon... ok
so now.. what i did, i follow your suggestion and also i took out the $header variable from the mail() function... and IT WORKS... thanks man...
here it is
[PHP]
$header = "From: kris <kristian@atpthailand.com>\r\n";
$header .= "Cc: skimmerboi@gmail.com\r\n";
$header .= "Bcc: \r\n";
$header .= "Reply-To: kristian@atpthailand.com\r\n";
$header .= "Content-Type: text/html; charset=TIS-620 \n";
$header .= "MIME-Version: 1.0 \r\n";
echo $header;
ini_set('SMTP','mail.asianet.co.th');
if(mail("k_bonbon_h5@yahoo.com", "test", "message here")){
echo 'SENT!!!!';
}else{
echo 'FAILED!!!!';
}
[/PHP]
uhmmm.. its really confusing.. coz the last time i used this code.. it was working.. coz i was trying to send html contents... so if i took this code out..
$header = "From: kris <kristian@atpthailand.com>\r\n";
$header .= "Cc: skimmerboi@gmail.com\r\n";
$header .= "Bcc: \r\n";
$header .= "Reply-To: kristian@atpthailand.com\r\n";
$header .= "Content-Type: text/html; charset=TIS-620 \n";
$header .= "MIME-Version: 1.0 \r\n";
how am i suppose to generate html contents on email.. i mean is there something wrong with this headers?
purple.. thank you so much for your time.. i really appreciate it.. ^__^..
Hi Bonski,
I am pleased you have it working..
as an aside if you haven't already, take a look at this.
sending text or HTML as the message body should make no difference.
Regards Purple
ei purple
thank you so much man..
and thanks also for the link you gave me about errors.. i knew about mysql_error().. but the error_reporting() is kinda new to me.. and i'd been looking for something like that since morning.. so that i could track down whats wrong.. so thank you so much..
take care always..^__^..
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Janna Deegan |
last post by:
Hello all,
First off, if there is a better place to post for an answer to this
question, please feel free to point me there.
I have some very strange behavior happening with my System.web.mail...
|
by: punitshrivastava |
last post by:
Hi to All.
I am Punit .I am back with new question .Please help me.
I want to create one enquiry form in php.for this I code it:
form code:
<form name="enquiry" method="post" ...
|
by: nitindel |
last post by:
Hi All,
Greetings..!!
I am using Persits Software to send mail in my Project through ASP,VBSCRIPT...
But Mail is not going to the recepient...instead it is showing the following strange...
|
by: Ronald Raygun |
last post by:
I am calling the mail() function in a PHP script and I get the ff error:
Warning: mail() : SMTP server response: 501 5.5.4 Invalid
Address in C:\test\test.php on line 394
Relevant Info:
OS:...
|
by: Don Quijote de Nicaragua |
last post by:
Hi, everyone I try to send a simple e-mail witch this Code, but always
send me a error messages:
"ERROR: Failure sending mail."
Thansk You.
Don Quijote de Nicaragua.
Elder Soto.
Dim correo As...
|
by: creative1 |
last post by:
I am trying to setup contactus page. and testing it to work throug localhostI. I ahve setup everything php.ini and even tred to use following to make sure that everything is ok:
...
|
by: mukeshrasm |
last post by:
Hi I am no able to send mail and it is giving this error
Warning: mail(): SMTP server response: 530 5.7.3 Client was not authenticated in c:\inetpub\wwwroot\eshop\includes\classes\email.php on...
|
by: lisa007 |
last post by:
Warning: mail() : SMTP server response: 503 valid RCPT command must precede DATA on
whenever user click on to get new password but doesnt fill in the username field it shows that message i have...
|
by: gspgsp |
last post by:
When sending mail we are getting this error:
SMTP, Server Response: '550 5.7.1 <xxxxx@yahoo.com>... Relaying denied. IP name possibly forged
Before it worked fine. For hosting and testing the...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |