[eluser]asmaa kamal[/eluser]
i got this error
Quote:( ! ) Fatal error: Call to a member function initialize() on a non-object in C:\wamp\www\t\application\config\email.php on
when putting email configuration in this config/email.php
this is code in file
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
$config['protocol'] = 'sendmail';
$config['mailpath'] = '/usr/sbin/sendmail';
$config['charset'] = 'iso-8859-1';
$config['wordwrap'] = TRUE;
$this->email->initialize($config);
?>
and i got the error
Quote:Exit status code: 1
Unable to open a socket to Sendmail. Please check settings.
Unable to send email using PHP Sendmail. Your server might not be configured to send mail using this method.
User-Agent: CodeIgniter
Date: Mon, 6 Feb 2012 15:38:37 +0000
From: "wathbaTeam"
Return-Path:
To: [email protected]
Subject: =?iso-8859-1?Q?lost_password?=
Reply-To: "[email protected]"
X-Sender: [email protected]
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
when i put this configuration ::: config/email.php
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'localhost';
$config['smtp_user'] = '[email protected]';
$config['smtp_pass'] = 'myDomain';
$config['validate']=TRUE ;
$config['port'] = 25;
$config['newline'] = "\r\n";
?>
this code in user_model :::
Code:
function reset_password($userEmail){
$this->load->library('email');
$config['protocol'] = 'sendmail';
$config['mailpath'] = '/usr/sbin/sendmail';
$config['charset'] = 'iso-8859-1';
$config['wordwrap'] = TRUE;
$this->email->initialize($config);
$temp_password='';
$length=8;
$i=0;
$characters='0123456789abcdefghijklmnopqrstuvwxyz';
for($i=0;$i<$length;$i++)
{
$maxlength=strlen($characters);
if ($length > $maxlength) {
$length = $maxlength;
}
$char = substr($characters, mt_rand(0, $maxlength-1), 1);
if (!strstr($temp_password, $char)) {
// no, so it's OK to add it onto the end of whatever we've already got...
$temp_password .= $char;
}}
$query=$this->db->where('userEmail',$userEmail)->get('users');
foreach($query->result() as $row)
{
$userName=$row->userName;
$userId=$row->userId ;
}
$data=array('temp_password'=>$temp_password );
$this->db->where('userEmail', $userEmail);
$this->db->update('users',$data);
$this->email->from('[email protected]', 'wathbaTeam');
$this->email->to($userEmail);
$this->email->subject('lost password');
$this->email->message("to reset your password please click://localhost/index.php/main/confirm_password_reset/$temp_password ");
$this->email->send();
echo $this->email->print_debugger();
}
the smtp works fine
and i have a running Test Mail Server Tool
any help ?