Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I know that this is already multiple answered here, but all these answers did not helped me with my problem. Because it is the simpliest way for testing, I use the mail protocol, and work on my local xampp machine. Here is my relevant code:

<?php
$this->load->library('email');

$this->email->initialize(array(
    'mailtype' => 'html',
    'validate' => TRUE
);

$this->email->from($this->config->item('[email protected]', 'Test');
$this->email->to($email);
$this->email->subject('ServerManager Registration');
$this->email->message($mail_content);
if ($this->email->send()) {
    // This becomes triggered when sending
}
?>

The variables $mail_content and $email are correctly spelled and working.

I enabled mail() logging in my xampp environment, so I am able to show you the log triggered:

mail() on [C:\xampp\htdocs\core\system\libraries\Email.php:1553]: To: ***@live.de -- Headers: User-Agent: CodeIgniter Date: Thu, 13 Jun 2013 18:14:46 +0200 From: "ServerManager" <[email protected]> Return-Path: <[email protected]> Reply-To: "[email protected]" <[email protected]> X-Sender: [email protected] X-Mailer: CodeIgniter X-Priority: 3 (Normal) Message-ID: <[email protected]> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="B_ALT_51b9eff6ab7c2"
share|improve this question
XAMPP does not come with a mail server which is required to send mail. Do you have some kind of mail server running on the machine hosting xampp? Also try using echo $this->email->print_debugger(); to check for errors. – Bad Wolf Jun 13 at 17:53
Isn't the standard mail() function already in the standard php installation? The debugging function does not show something that looks like an error, only my entered informations. – hice3000 Jun 13 at 18:06

1 Answer

up vote 0 down vote accepted

The problem may be caused due to usage of $this->config->item. Try this

    $this->load->library('email');
    $this->email->initialize(array(
     'mailtype' => 'html',
     'validate' => TRUE,
    ));

    $this->email->from('[email protected]', 'Test');
    $this->email->to($email);
    $this->email->subject('ServerManager Registration');
    $this->email->message($mail_content);
    if ($this->email->send()) {
        // This becomes triggered when sending
        echo("Mail Sent");
    }else{
        echo($this->email->print_debugger()); //Display errors if any
    }

P.S In you code ) were missing in two places

Update: Checked the script by sending mail to gmail, yahoo and rediffmail accounts from localhost. Mail was delivered in gmail(Was present in spam folder). As for yahoo and rediffmail, the mail has not been delivered yet(15 mins have passed) to inbox or spam/trash folder

share|improve this answer
They may be missing because i cutted out some not important db queries. It does not work without the config request, too. – hice3000 Jun 13 at 18:08
any error messages? I checked the script in my localhost and it works fine. – curious_coder Jun 13 at 18:09
no, but then my host might fail. I will try it on another server, and will comment than again. – hice3000 Jun 13 at 18:19
When you execute the script does Mail Sent being displayed but mail is not delivered? – curious_coder Jun 13 at 18:22
Of course, it is saying "Result: Your message has been successfully sent using the following protocol: mail ....." – hice3000 Jun 13 at 18:27
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.