2

I'm using the following code for sending mail in codeigniter

$this->load->library('email');
$this->email->set_mailtype('html');
$this->email->from('test@example.com', 'Your Name');
$this->email->to('test2@example.com'); 

$this->email->subject('Email Test');
$this->email->message('Testing the email class.');  

$this->email->send();

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

Here I'm getting the error as

Unable to send email using PHP mail(). Your server might not be configured to send mail using this method.

But if the mail type is change to text, ie

$this->email->set_mailtype('text');

It works fine.Why is it so ?

I'm nidhin
  • 2,592
  • 6
  • 36
  • 62

2 Answers2

1
$config['charset'] = 'utf-8';
$config['wordwrap'] = TRUE;
$config['mailtype'] = 'html';
$this->email->initialize($config);

Try this.

Brad Larson
  • 170,088
  • 45
  • 397
  • 571
Brijesh Tanwar
  • 143
  • 1
  • 9
0

Need an email.php file.

$config['protocol'] = 'sendmail';
$config['mailpath'] = '/usr/sbin/sendmail';
$config['charset'] = 'iso-8859-1';
$config['wordwrap'] = TRUE;

reference, this URL: http://www.ciboard.co.kr/user_guide/en/libraries/email.html

Brijesh Tanwar
  • 143
  • 1
  • 9