简体   繁体   English

mail():无法通过“ localhost”端口25连接到邮件服务器,无法在php.ini中验证“ SMTP”和“ smtp_port”设置,或使用ini_set()

[英]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 am currently working on send mail in codeigniter below are details of smtp but I am getting error how to solve this issue some posts on stackoverflow asked to make some modifications in php.ini still getting same issue. 我目前正在在codeigniter中发送邮件,以下是smtp的详细信息,但如何处理此问题却出现了错误,关于stackoverflow的一些帖子要求在php.ini中进行一些修改,但仍然出现相同的问题。

$config = Array(//for gmail Settings 
                    'protocol' => 'smtp',
                    'smtp_host' => 'ssl://smtp.gmail.com',
                    'smtp_port' => 465,
                    'smtp_user' => 'xyz@gmail.com', // user details
                    'smtp_pass' => 'xyzxyz', // password
                    'mailtype' => 'html',
                    'charset' => 'iso-8859-1',
                    'wordwrap' => TRUE
                );




               $this->load->library('email', $config);
                $this->email->set_header('MIME-Version', '1.0; charset=utf-8');
                $this->email->set_header('Content-type', 'text/html');
                $this->email->set_newline("\r\n");
                 $this->email->from('xyz@gmail.com@gmail.com', 'xyz.com'); //sender's email

                $this->email->to($email); // change it to yours
                $this->email->subject('Password reset email');
                $message = "<h2>You have requested to reset password</h2>";
                $message .= "<a href='" . base_url('controller') . "/" . "methodname/" . $reset . "'> Click here to reset your password</a>";
                $this->email->message($message);
                $send = $this->email->send();

This config helped me to solve my issue 这个配置帮助我解决了我的问题

$config = array(
                    'protocol' => 'smtp',
                    'smtp_host' => 'smtp.gmail.com',
                    'smtp_port' => 465,
                    'smtp_crypto' => 'ssl',
                    'smtp_timeout' => '30',
                    'smtp_user' => 'xyz@gmail.com', //  your smtp user
                    'smtp_pass' => 'xyzxyz', //  your smtp password
                    'wordwrap' => TRUE
                );

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 警告:mail():无法连接到“localhost”端口25上的邮件服务器,验证php.ini中的“SMTP”和“smtp_port”设置或使用ini_set() - Warning: mail(): Failed to connect to mailserver at “localhost” port 25, verify your “SMTP” and “smtp_port” setting in php.ini or use ini_set() mail():无法在“localhost”端口 25 连接到邮件服务器,请验证 php.ini 中的“SMTP”和“smtp_port”设置 - mail(): Failed to connect to mailserver at “localhost” port 25, verify your “SMTP” and “smtp_port” setting in php.ini 无法通过“ localhost”端口587连接到邮件服务器,无法在php.ini中验证您的“ SMTP”和“ smtp_port”设置,或在wamp服务器中使用ini_set() - Failed to connect to mailserver at “localhost” port 587, verify your “SMTP” and “smtp_port” setting in php.ini or use ini_set() in wamp server 警告:mail()[function.mail]:无法连接到“localhost”端口25的邮件服务器,验证你的“SMTP”和“smtp_port”,XAMPP for WIndows XP - Warning: mail() [function.mail]: Failed to connect to mailserver at “localhost” port 25, verify your “SMTP” and “smtp_port”, XAMPP for WIndows XP PHP:mail()函数,运行时为ini_set(),SMTP和SMTP_PORT不在Linux上运行 - PHP: mail() function with runtime ini_set() for SMTP and SMTP_PORT not working on Linux 无法连接到“localhost”端口25上的邮件服务器,验证您的“SMTP” - Failed to connect to mailserver at “localhost” port 25, verify your “SMTP” Php ini_set mail smtp - Php ini_set mail smtp 我更改了SMTP和SMTP端口,但它仍然说无法连接到“localhost”端口25的邮件服务器 - I changed the SMTP and SMTP Port but it still says Failed to connect to mailserver at “localhost” port 25 mail()函数ini_set()smtp服务器本地主机不起作用 - mail() function ini_set() smtp server localhost not work PHPMAILER Mailer错误:SMTP connect()失败(无法访问Php.ini) - PHPMAILER Mailer Error: SMTP connect() failed (No Access to Php.ini)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM