• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[solved] Email Class - sending email twice (unwanted)

#1
[eluser]eakroko[/eluser]
hello,

i have a problem with the Email Class.
I simply want to send an email to a client.
Here is my code:
Code:
$this->load->library('email');
$config['wordwrap'] = TRUE;

$this->email->initialize($config);
$this->email->from('[email protected]', 'My-Name');
$this->email->to('[email protected]');
$this->email->subject("test-email");
$this->email->message('test');    

$this->email->send();

echo $this->email->print_debugger();

This works fine at localhost.
But on my server it sends the Email to the [email protected] AND to me ([email protected]). I don't know why I also get the email.

If I use php mail() function it doesn't send the email twice. So it has to do something with Codeigniter Email-Class.

I would appreciate help.


Edit:
with
Code:
$config['protocol'] = "sendmail";
there is only one email sending. But this one arrives at the FROM-adress and not at the clients adress.

Is there maybe a problem with my servers settings? When yes, why php mail() function is working ?

Thanks

#2
[eluser]CodeIgniteMe[/eluser]
Maybe the that the sender receives is an email sending failed message, which first, the message is sent back and then a big footer which tells you that the email you provided does not exist or is invalid

#3
[eluser]eakroko[/eluser]
I also thought that this might be the problem.
But I tested it with 2 valid emails of myself. The message is not sent back, it just arrives at the from-adress and the to-adress without an error.
The email-class debugger shows no error.

#4
[eluser]CodeIgniteMe[/eluser]
I use a third party script such as PHPMailer and SwiftMail so I haven't experience this bug or situation.
The first thing that came to my mind is that, maybe you should re-initialize the email class especially when using a loop, to cleanup unnecesary data. But then I read again and saw that your problem is that the sender is also sent the message.

#5
[eluser]eakroko[/eluser]
I also tried to use this:
Code:
$this->email->clear();

but it didnt help.. well there is no reason at all that the sender gets an email.
Guess I have to use SwiftMail or another 3rd party script.

Thanks anyway

#6
[eluser]eakroko[/eluser]
Okay i solved it with the 3rd party script SwiftMailer.

Thanks.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.