CodeIgniter Forums

Full Version: HTML Email Fails when Mailtype is set
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]bafadam[/eluser]
I can send a text e-mail just fine, but when I try and initialize the html setting for the e-mail, I get a bunch of errors.

Here's the code that doesn't work, though if you remove the third line, it works just fine (obviously when the message and all that other stuff is set.

Code:
$this->load->library('email');
$this->email->set_newline("\r\n");
$this->email->initialize(array('mailtype' => 'html'));

It tosses out this:
A PHP Error was encountered

Severity: Warning

Message: mail() [function.mail]: Bad parameters to mail() function, mail not sent.

Filename: libraries/Email.php

Line Number: 1519

El Forum

[eluser]skunkbad[/eluser]
[quote author="bafadam" date="1260051424"]I can send a text e-mail just fine, but when I try and initialize the html setting for the e-mail, I get a bunch of errors.

Here's the code that doesn't work, though if you remove the third line, it works just fine (obviously when the message and all that other stuff is set.

Code:
$this->load->library('email');
$this->email->set_newline("\r\n");
$this->email->initialize(array('mailtype' => 'html'));

It tosses out this:
A PHP Error was encountered

Severity: Warning

Message: mail() [function.mail]: Bad parameters to mail() function, mail not sent.

Filename: libraries/Email.php

Line Number: 1519[/quote]

I just had this exact same problem last week! I changed the mail protocol from 'mail' to 'sendmail', and then everything worked perfectly.

El Forum

[eluser]Unknown[/eluser]
Same problem with "smtp" protocol :/

El Forum

[eluser]Sbioko[/eluser]
Can you provide the text you want to send?

El Forum

[eluser]novice32[/eluser]
When I use
Code:
$this->email->initialize(array('mailtype' => 'html'));
, I receive in my Gmail an empty content email with a "noname" attachment. The attachments contains the the content, unformatted. I tried both sendmail and smtp protocol.

El Forum

[eluser]cahva[/eluser]
When are you initializing? Remember that initialize also sets from, to etc. to blank so the initialization should be made before setting any of those parameters.

El Forum

[eluser]novice32[/eluser]
I have email.php under my config folder, so no initializing required. Although I have mailtype set to html, it receive emails with nonmame attachment.. that why I tried using
Code:
$this->email->initialize(array('mailtype' => 'html'));
I started another thread with this issue: http://ellislab.com/forums/viewthread/151416/

El Forum

[eluser]ericbae[/eluser]
Just like skunkbad did, it worked for me when I changed from mail to sendmail.

It's strange because "mail" protocol was working fine, until a few days ago. Maybe my hosting server changed some settings?