CodeIgniter Forums
HTML Email Fails when Mailtype is set - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forum-21.html)
+--- Thread: HTML Email Fails when Mailtype is set (/thread-25245.html)



HTML Email Fails when Mailtype is set - El Forum - 12-05-2009

[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


HTML Email Fails when Mailtype is set - El Forum - 12-05-2009

[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.


HTML Email Fails when Mailtype is set - El Forum - 01-04-2010

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


HTML Email Fails when Mailtype is set - El Forum - 01-04-2010

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


HTML Email Fails when Mailtype is set - El Forum - 04-04-2010

[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.


HTML Email Fails when Mailtype is set - El Forum - 04-04-2010

[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.


HTML Email Fails when Mailtype is set - El Forum - 04-06-2010

[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/


HTML Email Fails when Mailtype is set - El Forum - 04-12-2010

[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?