Welcome Guest, Not a member yet? Register   Sign In
Email bug?
#1

[eluser]theshiftexchange[/eluser]
Why does the "cc" of an email carry over to another email unexpectedly?

To replicate;

1. Install a clean fresh copy of Codeigniter 2.1.2 from the website. Make no changes whatsoever
2. Edit the "welcome.php" file and change the index function to the code below
3. Run the index.

Code:
public function index()
{
  $this->load->library('email');

  $this->email->from('[email protected]', 'Codetest');      
        $this->email->to('[email protected]');
        $this->email->cc('[email protected]');
        $this->email->subject('Test subject');
        $this->email->message('This is a test email');
        $this->email->send();
        echo $this->email->print_debugger();

  $this->email->from('[email protected]', 'Codetest');      
        $this->email->to('[email protected]');
        $this->email->subject('Another test subject');
        $this->email->message('This is a test email');
        $this->email->send();
        echo $this->email->print_debugger();

}


You can see in the print_debugger, that the second email includes the "cc" from the first email. It seems as though it is held in memory in between the send functions.

Surely it should be wiped after the send, to avoid inadvertently "cc" people on emails who should not be "cc"??

This is the print debugger output:

Code:
Your message has been successfully sent using the following protocol: mail

From: "Codetest"
Return-Path:
Cc: [email protected]
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
=?utf-8?Q?Test_subject?=
This is a test email

Your message has been successfully sent using the following protocol: mail
Your message has been successfully sent using the following protocol: mail

From: "Codetest"
Return-Path:
Cc: [email protected]  <---- WTF??!!?!?
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
=?utf-8?Q?Another_test_subject?=
This is a test email
#2

[eluser]theshiftexchange[/eluser]
so apparently the issue is that you HAVE TO use

$this->email->clear()

in between emails. That seems dangerous - why not make "$this->email->clear()" run automatically, and have a variable to turn it off (on by default)?
#3

[eluser]InsiteFX[/eluser]
Maybe take look at the clear method in the Email library to see what it is doing.
#4

[eluser]theshiftexchange[/eluser]
[quote author="InsiteFX" date="1343453612"]Maybe take look at the clear method in the Email library to see what it is doing.
[/quote]

I can see how it works... now Smile

So this is thread is probably more a "design issue" rather than "bug".

It seems dangerous that an email can silently contain data from a previous email.

It would seem more logical that the email data is automatically cleared after you use the send() function, and it only "remembers" the old data if you specifically ask it (or configure it) to?
#5

[eluser]InsiteFX[/eluser]
You can say something about it here and they may fix it.

CodeIgniter Issues

I think they wrote it like that because of mass mailing.
#6

[eluser]Unknown[/eluser]
it's error , the message is:


A PHP Error was encountered

Severity: Warning

Message: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set()

Filename: libraries/Email.php

Line Number: 1519

Unable to send email using PHP mail(). Your server might not be configured to send mail using this method.
From: "Codetest"
Return-Path:
Cc: [email protected]
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
=?utf-8?Q?Test_subject?=
This is a test email
A PHP Error was encountered

Severity: Warning

Message: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set()

Filename: libraries/Email.php

Line Number: 1519

Unable to send email using PHP mail(). Your server might not be configured to send mail using this method.
Unable to send email using PHP mail(). Your server might not be configured to send mail using this method.
From: "Codetest"
Return-Path:
Cc: [email protected]
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
=?utf-8?Q?Another_test_subject?=
This is a test email




can you fix that
#7

[eluser]PhilTem[/eluser]
Code:
Message: mail() [function.mail]: Failed to connect to mailserver at “localhost” port 25, verify your “SMTP” and “smtp_port” setting in php.ini or use ini_set()
and
Code:
Unable to send email using PHP mail(). Your server might not be configured to send mail using this method.

obviously mean that it's a missing or misconfiguration of your server. Does not relate directly to any CI issue(s). You should check your server's php.ini file.




Theme © iAndrew 2016 - Forum software by © MyBB