Exit status code 1 Unable to send email

advertisements

I'm attempting to send an email out to the person(s) who register for my site using the Email Class provided with Codeigniter for my project. I am receiving the following error message.

Exit status code: 1
Unable to open a socket to Sendmail. Please check settings.
Unable to send email using PHP Sendmail. Your server might not be configured to sendmail using this method.

$this->email->message('Welcome to '.$this->config->item('company_name').', "\r\n" Thank you for joining the '.$this->config->item('company_name').' team. We have listed your registration details below. Make sure you save this email. To verify this account please click the following link. "\r\n" '.anchor('register/verify/'.$registration_key, 'Click Here To Activate Your Account', '').' "\r\n" Please verfiy your account within 2 hours, otherwise your registration will become invalid and you will have to register again. "\r\n" Your email address: '.$post_email_address.' "\r\n" Your Password: '.$post_password.' "\r\n" Enjoy your stay here at '.$this->config->item('company_name').' "\r\n" The '.$this->config->item('company_name').' Team');

UPDATE :

I am updating my code because for some reason I am still receiving an the same error and I can't figure out what it is that is giving me the error.

../application/configs/site_configs.php
<?php

$config['company_name'] = 'My Test Site';
$config['comapny_email'] = '[email protected]';

I would also like to mention here that I am autoloading my site configs file.

$autoload['config'] = array('site_configs');

Register Controller

// User was successfully created and the user needs to verify their account.
// Send registered an email informing them how to validate their account.
$this->load->library('email');
$this->email->from($this->config->item('company_email'), $this->config->item('company_name'));
$this->email->to($post_email_address);
$this->email->subject($this->config->item('company_name').' Registration');
//$message = 'Welcome to '. $this->config->item('company_name') ."\r\n";
//$message .= 'Thank you for joining the ' . $this->config->item('company_name') . ' team.';
//$message .= 'We have listed your registration details below. Make sure you save this email.';
//$message .= 'To verify this account please click the following link.'."\r\n";
//$message .= anchor('register/verify/'.$registration_key, 'Click Here To Activate Your Account', '')."\r\n";
//$message .= 'Please verfiy your account within 2 hours, otherwise your registration will become invalid and you will have to register again.'."\r\n";
//$message .= 'Your email address: '.$post_email_address."\r\n";
//$message .= 'Your Password: '.$post_password."\r\n";
//$message .= 'Enjoy your stay here at '.$this->config->item('company_name')."\r\n";
//$message .= 'The '.$this->config->item('company_name').' Team';
$this->email->message('Great registration.' /*$message */);
$this->email->send();
echo $this->email->print_debugger();


Also try to have your code be a little more readable.. I notice, your gigantic string for the message is riddled with continuations going in and out of dynamic variables. Chaining the string together as it goes along.

Why not try

$message = 'Welcome to '. $this->config->item('company_name') ."\r\n";
$message .= 'Thank you for joining the ' . $this->config->item('company_name') . ' team.';
$message .= 'We have listed your registration details below. Make sure you save this email.';
$message .= 'To verify this account please click the following link.'."\r\n";
$message .= .anchor('register/verify/'.$registration_key, 'Click Here To Activate Your Account', '')."\r\n";
$message .= 'Please verfiy your account within 2 hours, otherwise your registration will become invalid and you will have to register again.'."\r\n";
$message .= 'Your email address: '.$post_email_address."\r\n";
$message .= 'Your Password: '.$post_password."\r\n";
$message .= 'Enjoy your stay here at '.$this->config->item('company_name')."\r\n";
$message .= 'The '.$this->config->item('company_name').' Team';

$this->email->message($message);

Where its a bit more manageable and readable. So you can see where your missing a single or double quote or where you might be missing a period that would chain string to variable, etc..

The only thing Im not sure about is one line had .anchor() not sure if thats a function or something else but didn't look complete.