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 8447495
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:11:24+00:00 2026-06-10T10:11:24+00:00

Scenario: I have a number of Codeigniter applications that I am improving the email

  • 0

Scenario: I have a number of Codeigniter applications that I am improving the email delivery system to use a database queue. So my application logs all emails that need to be sent into the database. I run a cron job every minute to check this database queue and send out any pending emails (throttled to my server limits as needed).

It is all working fantastically and has dramatically improved our applications.

Part of the feature is it will record when emails are not sent, and will retry again later. As part of the process I update the database to include any error messages during the send attempts, for debugging later. I do this with $this->email->print_debugger().

Once again all working ok (normally).

The problem is if an attachment was included in the email, the attachment ‘data’ is dumped as part of the print_debugger() – so my database gets smashed with large text dumps of attachment data.

What I tried: So I went looking in the Email.php class of codeigniter, thinking I could extend the library to just not include the attachment data in the print_debugger() function – but it seems that the error that is returned from the function is actually from the SMTP server itself in another function. I cant see a way to stop the attachment data coming through on the error.

Question/Challenge: Can anyone see a way where I can capture an SMTP error, and the email headers – but not the attachment data? I’m happy to settle for not capturing any of the email body either (since I know what that is anyway in my database queue).

  • 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-06-10T10:11:26+00:00Added an answer on June 10, 2026 at 10:11 am

    I believe that you can just extend the library. This is the current function:

    public function print_debugger()
    {
        $msg = '';
    
        if (count($this->_debug_msg) > 0)
        {
            foreach ($this->_debug_msg as $val)
            {
                $msg .= $val;
            }
        }
    
        $msg .= "<pre>".$this->_header_str."\n".htmlspecialchars($this->_subject)."\n".htmlspecialchars($this->_finalbody).'</pre>';
        return $msg;
    }
    

    There are four main parts to what is returned:

    • _debug_msg – The debug messages
    • _header_str – The email’s headers
    • _subject – The email’s subject
    • _finalbody – The body of the message and the attachment data

    Implementing a similar function, without _finalbody should give you the desired output but without the body and attachment data.

    Here’s an example solution, (with the class ‘MY_Email’ located here at: application/libraries/MY_Email.php):

    class MY_Email extends CI_Email
    {
        public function my_print_debugger()
        {
            $msg = '';
    
            if (count($this->_debug_msg) > 0)
            {
                foreach ($this->_debug_msg as $val)
                {
                    $msg .= $val;
                }
            }
    
            $msg .= "<pre>".$this->_header_str."\n".htmlspecialchars($this->_subject)."\n".'</pre>';
            return $msg;
        }
    }
    

    Looking through the code for the class, I think that $_body may contain the body data without the attachment data, so it could be worth trying to append $this->_body, rather than $this->_finalbody to the function. I’ve haven’t tested this, so I’m not certain.

    Hopefully this helps!

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

Sidebar

Related Questions

Scenario I have a C# windows forms application that has a number of processes.
Scenario: I have a console application that needs to access a network share with
I have a scenario where I have an inordinate number of updates that have
Scenario I have a very heavy number-crunching process that pools large datasets from 3
I have the following scenario: I have five fields in my database (name, email,
I'm stuck with the following scenario and appreciate any help/advice.. Requirement I have number
I have a scenario where I want to prove a lemma including a number
Beginner level question Scenario: Have simple string cocantation tool, that I might expand later
Scenario I have a line of code whereby I pass a good number of
Here's the scenario: I have an external swf file with x number of movieclips

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.