私のプロジェクト用に Codeigniter で提供されている電子メール クラスを使用して、私のサイトに登録した人に電子メールを送信しようとしています。次のエラー メッセージが表示されます。
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');
アップデート :
なんらかの理由でまだ同じエラーが発生し、エラーの原因がわからないため、コードを更新しています。
../application/configs/site_configs.php
<?php
$config['company_name'] = 'My Test Site';
$config['comapny_email'] = 'owner@testingsite.com';
ここで、サイト構成ファイルを自動ロードしていることにも言及したいと思います。
$autoload['config'] = array('site_configs');
コントローラの登録
// 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();