Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4236396
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T02:37:59+00:00 2026-05-21T02:37:59+00:00

Greetings! I just downloaded version 2.0.1 of CodeIgniter framework and I am attempting to

  • 0

Greetings!

I just downloaded version 2.0.1 of CodeIgniter framework and I am attempting to write my own email controller like so:

<?php

class Email extends CI_Controller
{
     function __construct()     {         parent::__construct();     } 

    function index()     {   
        $this->load->library('email', $config);
        $this->email->set_newline("\r\n");

        $this->email->from('some.email@gmail.com', 'some.email.name');
        $this->email->to('some.author.email.@gmail.com');        
        $this->email->subject('This is an email test');        
        $this->email->message('It is working!');

        $path = $this->config->item('server_root');        

        $file = $path . '/attachments/readme.txt';

        $this->email->attach($file);

        if($this->email->send())         {             echo 'Email sent.';         }        
        else        {            show_error($this->email->print_debugger());        }
    }
}

If I point my browser to “http://localhost/CodeIgniter/index.php/email&#8221;, I get this PHP error message

A PHP Error was encountered
Severity: Notice
Message: Undefined variable: config
Filename: controllers/email.php
Line Number: 24

The line number 24 points to this line of code in my controller $this->load->library(’email’, $config);

In spite of the PHP error, email is being sent fine, with a file attachment.

How can I remove this PHP error? What am I doing wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T02:38:00+00:00Added an answer on May 21, 2026 at 2:38 am

    As the message states, $config is not defined. You could fix it by defining it.

    $config = Array();

    somewhere before line 24 should do it

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Greetings everyone, i would just like to ask how do i retrieve data rows
Greetings! I am trying to check directory write-permissions from within a Windows MFC/ATL program
Greetings, I want to write a script that handles simple http requests from Google
Greetings. I'm just getting started with the boost::asio library and have run into some
Greetings, I am just starting with IzPack and I have a question for which
So i've just finished the google app engine greetings tutorial. All well so far.
Greetings. In attempt to wrap my head around MVC I've just implemented a simple
Greetings everyone, i just wanna ask.. how do i disable the right click property
Greetings, this is my very first question and I just do programming as a
Greetings, I have three TS variables resembling something like the following: data <- read.csv(...)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.