PHP Classes

possible error in send_mail

Recommend this page to a friend!

      Access user Class  >  All threads  >  possible error in send_mail  >  (Un) Subscribe thread alerts  
Subject:possible error in send_mail
Summary:problem sending validation email when auto_authorize=false
Messages:2
Author:Tim Norton
Date:2007-04-26 12:19:39
Update:2007-04-26 14:17:02
 

  1. possible error in send_mail   Reply   Report abuse  
Picture of Tim Norton Tim Norton - 2007-04-26 12:19:39
I think I found an error where if you set var $auto_activation = false; then the validation email sent to yhe user is actually the admin email.

I believe this is an error in the send_mail function
if (!$this->auto_activation) {

$subject = "New user request...";
$body = "New user registration on ".date("Y-m-d").":\r\n\r\nClick here to enter the admin page:\r\n\r\n"."http://".$_SERVER['HTTP_HOST'].$this->admin_page."?login_id=".$this->id;

} else {
$subject = $this->messages(28);
$body = $this->messages($num);
}


I corrected this by remming out the following and then creating a new function

//if (!$this->auto_activation) {

//$subject = "New user request...";
//$body = "New user registration on ".date("Y-m-d").":\r\n\r\nClick here to enter the admin page:\r\n\r\n"."http://".$_SERVER['HTTP_HOST'].$this->admin_page."?login_id=".$this->id;

//} else {
$subject = $this->messages(28);
$body = $this->messages($num);
//}

\

NEW FUNCTION **************************************8

function send_mailAdmin($mail_address, $num = 29) {
$header = "From: \"".$this->webmaster_name."\" <".$this->webmaster_mail.">\r\n";
$header .= "MIME-Version: 1.0\r\n";
$header .= "Mailer: Olaf's mail script version 1.11\r\n";
$header .= "Content-Type: text/plain; charset=\"iso-8859-1\"\r\n";
$header .= "Content-Transfer-Encoding: 7bit\r\n";
$subject = "New user request...";
$body = "New user registration on ".date("Y-m-d").":\r\n\r\nClick here to enter the admin page:\r\n\r\n"."http://".$_SERVER['HTTP_HOST'].$this->admin_page."?login_id=".$this->id;


if (mail($mail_address, $subject, $body, $header)) {
return true;
} else {
return false;
}
}


AND ADDED TO activate_account*********************************************************
if ($this->auto_activation) {
$upd_sql = sprintf("UPDATE %s SET active = 'y' WHERE id = %s AND pw = '%s'", $this->table_name, $key_id, $activate_key);
if (mysql_query($upd_sql)) {
if ($this->send_confirmation($key_id)) {
$this->the_msg = $this->messages(18);
} else {
$this->the_msg = $this->messages(14);
}
} else {
$this->the_msg = $this->messages(19);
}
} else {
***************
if ($this->send_mailAdmin($this->admin_mail, 0, true)) {
$this->the_msg = $this->messages(36);
***************
} else {
$this->the_msg = $this->messages(14);
}
}
} else {
$this->the_msg = $this->messages(20);
}




Any comments on my evaluation?
\\


Tim

  2. Re: possible error in send_mail   Reply   Report abuse  
Picture of Olaf Lederer Olaf Lederer - 2007-04-26 14:17:02 - In reply to message 1 from Tim Norton
Hi,

check the latest version on my website.

Olaf