Welcome Guest, Not a member yet? Register   Sign In
Message: mail() [function.mail]: Bad parameters to mail() function, mail not sent - Can You Help?
#1

[eluser]Stephane02[/eluser]
I just tried to send an html e-mail using the e-mail library in CodeIgniter and it reported the following error (sending text e-mail works fine). Can you help?

Here is the exact error I got:

Code:
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

Here's my code:


Code:
$mconfig['useragent'] = 'My Mail Agent';
$mconfig['charset'] = 'UTF-8';
$mconfig['mailtype'] = 'html';
$mconfig['wordwrap'] = TRUE;

$this->email->initialize($mconfig);
$this->email->from('[email protected]', 'Company');
$this->email->to('[email protected]');
$this->email->subject('Stephane, Welcome from our team');
$this->email->message($msg); // $msg contains the html body
$this->email->send();


Thx for helping


Stephane
#2

[eluser]Đaяк Đaηтє[/eluser]
Are you loading Email class?

http://ellislab.com/codeigniter/user-gui...email.html
#3

[eluser]Stephane02[/eluser]
Yes, I'm loading it in config/autoload.php

/*
| -------------------------------------------------------------------
| Auto-load Libraries
| -------------------------------------------------------------------
| These are the classes located in the system/libraries folder
| or in your system/application/libraries folder.
|
| Prototype:
|
| $autoload['libraries'] = array('database', 'session', 'xmlrpc');
*/

$autoload['libraries'] = array('database', 'session', 'image_lib', 'recaptcha', 'form_validation', 'encrypt', 'email');
#4

[eluser]Stephane02[/eluser]
Nobody to help ?
#5

[eluser]ngatcharius[/eluser]
me too i have this problem!! how will i do?
#6

[eluser]WanWizard[/eluser]
Try one of both of these:
Code:
$mconfig['crlf'] = "\r\n";
$mconfig['newline'] = "\r\n";

Some mailservers require CRLF line-ends instead of only LF (which is the email library default).
#7

[eluser]ngatcharius[/eluser]
Code:
$config['wordwrap'] = TRUE;
$config['mailtype'] = "html";            
$config['charset'] = "UTF-8";            
$config['crlf'] = "\r\n";            
$config['newline'] = "\r\n";

$this->email->initialize($config);

it doesn't work i have same error !!! at the beginning when i'm not 'initialize' email $config it works but after it does not
why??
#8

[eluser]WanWizard[/eluser]
Something is malformed. If it's not the crlf or newline setting, it could be something in your message.
Try
Code:
$this->email->message( "<html><body>Hello</body></html>" ); // $msg contains the html body

Does this get send?
#9

[eluser]ngatcharius[/eluser]
noooo !! same problem
Code:
A PHP Error was encountered

Severity: Warning

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

Filename: libraries/Email.php

Line Number: 1519
#10

[eluser]ngatcharius[/eluser]
another way! i send email to many adress like
Code:
foreach ($list as $name => $address)
{
    $this->email->clear();

    $this->email->to($address);
    $this->email->from('[email protected]');
    $this->email->subject('Here is your info '.$name);
    $this->email->message('Hi '.$name.' Here is the info you requested.');
    $this->email->send();
}

when i use $this->email->clear();
$config is also clear?? will i put $config in loop ?




Theme © iAndrew 2016 - Forum software by © MyBB