Welcome Guest, Not a member yet? Register   Sign In
email class problem
#1

[eluser]thephpx[/eluser]
my index() in controller welcome.php :

$this->load->library(‘email’);
$config[‘protocol’] = ‘sendmail’;
$this->email->initialize($config);
$this->email->from(‘[email protected]’, ‘thephpx’);
$this->email->to(‘[email protected]’);
$this->email->subject(‘Email Test’);
$this->email->message(‘Testing the email class.’);
$this->email->send();
echo $this->email->print_debugger();

response text:

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, 16 Feb 2009 08:10:32 +0000
From: “thephpx”
Return-Path:
To: [email protected]
Subject: =?utf-8?Q?Email_Test?=
Reply-To: “[email protected]
X-Sender: [email protected]
X-Mailer: CodeIgniter
X-Priority: 3 (Normal)
Message-ID: <[email protected]>
Mime-Version: 1.0

Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

Testing the email class.

Please suggest what is the problem
#2

[eluser]sophistry[/eluser]
[quote author="thephpx" date="1234823863"]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.[/quote]

um... i think it is because your server might not be configured to send mail using this method. ;-)

try mail or smtp methods as suggested in the documentation.
#3

[eluser]M Moeen uddin[/eluser]
Do you find the solution of this problem? I m having the same issue.

Well, it was working a few days back, with no error. PHP inof shows that send mail path is correct and all other things also fine. what am i missing here?
#4

[eluser]Zorancho[/eluser]
Try this:
Code:
$this->load->library('email');
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'localhost';
$config['validate'] = 'TRUE';
$this->email->initialize($config);
$this->email->from('[email protected]', 'Your Name');
$this->email->to([email protected]);
$this->email->subject('Subject');
$message = 'The message';
$this->email->message($message);
$this->email->send();
#5

[eluser]tj[/eluser]
tnx for reply.i dont know whats my problem was now its works fine in sendmail and smtp maybe because of my server
#6

[eluser]Zorancho[/eluser]
it could be the server, my function is in MY_Controller.php class:
Code:
function send_email($from, $to, $from_name, $subject, $message, $attachment = NULL)
{
    $this->load->library('email');
    $config['protocol'] = 'smtp';
    $config['smtp_host'] = 'localhost';
    $config['validate'] = 'TRUE';
    $this->email->initialize($config);
    $this->email->from($from, $from_name);
    $this->email->to($to);
    $this->email->subject($subject);
    $this->email->message($message);
    if($attachment != NULL)
    {
        $this->email->attach($attachment);
    }
    if($this->email->send())
    {
        return TRUE;
    }
    return FALSE;
}
and it worked almost on every server i have been using.




Theme © iAndrew 2016 - Forum software by © MyBB