public function sendemail(){
$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'ssl://smtp.googlemail.com',
'smtp_port' => 465,
'smtp_user' => '[email protected]',
'smtp_pass' => 'password',);
$this->load->library('email', $config);
$this->email->set_newline("\r\n");
$this->email->from('[email protected]', 'Name');
$this->email->to('[email protected]');
$this->email->subject(' My mail through codeigniter from localhost ');
$this->email->message('Hello World…');
if (!$this->email->send()) {
show_error($this->email->print_debugger()); }
else {
echo 'Your e-mail has been sent!';
}
}
otrzymuję komunikat o błędzie, gdy używam CodeIgniter, aby wysłać e-mail:Wyślij e-mail przy użyciu biblioteki CodeIgniter poprzez localhost
Message: mail() [function.mail]: Failed to connect to mailserver at
"localhost" port 25, verify your "SMTP" and "smtp_port" setting in
php.ini or use ini_set().
i
Unable to send email using PHP mail(). Your server might not be
configured to send mail using this method.
Co robię źle?
Czy istnieje konfiguracja w localhost, aby można było wysłać wiadomość e-mail? –
Tak, musisz włączyć openssl w swoim localhostu –
dlaczego za każdym razem zmieniam $ this-> email-> from ('[email protected] '); na inny adres, np. yahoo, wiadomość e-mail, którą otrzymałem, była zawsze wysyłana z "mnie" zamiast nadawcy? –