Page 1 of 1

[Solved]mail not being delivered!

Posted: Tue Jun 22, 2010 4:40 pm
by manRay
I am sending my users confirmation emails through the mail() function. But they are being sent back to me because they could not be sent. I am not too sure what is wrong because it has been working for awhile.
Here is the code

Code: Select all

<?php

$firstname = $_POST["reg_fname"];
$lastname = $_POST["reg_lname"];
$email = $_POST["reg_email"];
$password = crypt($_POST["reg_pswrd"],'router');

$connection = mysql_connect("*************","*******","********");

//try to connect to database
if ($connection) {
	mysql_select_db("********", $connection);
	
	$result = mysql_query("SELECT * FROM accounts WHERE email = '$email'");
	$accounts = mysql_num_rows($result);
	
	//check to see if email address is already registered
	if ($accounts == 0) {
		$code = rand();
		$result2 = mysql_query("INSERT INTO register VALUES ('$code', '$firstname', '$lastname', '$email', '$password')");
		
		if ($result2) {
				
				$headers  = 'MIME-Version: 1.0' . "\r\n";
				$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
				$message = "Thanks for registering. Please cofirm your account by clicking on the link below.\n <a 			href='http://www.mysite.com/php/registration.php?id=" . $code. "'" . ">Confirm</a>";
				$sent_mail = mail($email,'Registration',$message,$headers,'-fadmin@mysite.com');
				
				if ($sent_mail) {
					echo "You have been added to the database. Thanks for registering";	
					echo "An email has been sent to your email to confirm your account";
				}
		}
		
		else {
			die("unable to insert data: ". mysql_error());
		}
	}
	
	//if email is already registered show to error
	else {
		echo "email already registered!";
	}
	
}

else {
	die("Not Connected: " . mysql_error());	
}

mysql_close($connection);
?>
Here is the email that was sent back
[text]
Hi. This is the qmail-send program at **************.
I'm afraid I wasn't able to deliver your message to the following addresses.
This is a permanent error; I've given up. Sorry it didn't work out.

<useremailaddress@yahoo.com>:
209.191.88.254 failed after I sent the message.
Remote host said: 554 delivery error: dd Sorry your message to useremailaddress@yahoo.com cannot be delivered. This account has been disabled or discontinued [#103]. - mta1034.mail.mud.yahoo.com

--- Below this line is a copy of the message.

Return-Path: <admin@mysite.com>
Received: (qmail 22948 invoked from network); 22 Jun 2010 19:27:37 -0000
Received: from unknown (HELO *************) ([ip address])
(envelope-sender <admin@mysite.com>)
by ************** (qmail-ldap-1.03) with SMTP
for <useremailaddress@yahoo.com>; 22 Jun 2010 19:27:37 -0000
Received: from ************* (localhost [127.0.0.1])
by ***************** (8.13.8/8.12.11) with ESMTP id o5MJRaLL031488
for <useremailaddress@yahoo.com>; Tue, 22 Jun 2010 12:27:36 -0700
Received: (from *********@localhost)
by ************************* (8.13.8/8.12.11/Submit) id o5MJRa8k031482;
Tue, 22 Jun 2010 12:27:36 -0700
Date: Tue, 22 Jun 2010 12:27:36 -0700
From: admin@mysite.com
Message-Id: <***********************************>
X-Authentication-Warning: **************************: ************* set sender to admin@mysite.com using -f
To: useremailaddress@yahoo.com
Subject: Registration
MIME-Version: 1.0
Content-type: text/html; charset=iso-8859-1


Thanks for registering. Please cofirm your account by clicking on the link below.
<a href='http://www.mysite.com/php/registration. ... Confirm</a>

[/text]

Re: mail not being delivered!

Posted: Tue Jun 22, 2010 7:21 pm
by requinix
Is it happening with more than one person/email address? Any pattern to who's affected?

Re: mail not being delivered!

Posted: Tue Jun 22, 2010 7:37 pm
by manRay
This is the first occurrence of it getting sent back to me.

Re: [Solved]mail not being delivered!

Posted: Wed Jun 23, 2010 12:41 am
by requinix
...

Well, then
this account has been disabled or discontinued
seems like a reasonable explanation.