Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/codeigniter/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
fsockopen():php\u network\u getaddresses:getaddrinfo失败:名称或服务未知_Php_Codeigniter_Codeigniter 2_Codeigniter 3 - Fatal编程技术网

fsockopen():php\u network\u getaddresses:getaddrinfo失败:名称或服务未知

fsockopen():php\u network\u getaddresses:getaddrinfo失败:名称或服务未知,php,codeigniter,codeigniter-2,codeigniter-3,Php,Codeigniter,Codeigniter 2,Codeigniter 3,我无法将表单内容发送到电子邮件。我得到以下错误: : Warning Message: fsockopen(): php_network_getaddresses: getaddrinfo failed:Name or service not known Filename: libraries/Email.php Line Number: 1986 Severity: Warning Message: fsockopen(): unable to connect to ssl://smt

我无法将表单内容发送到电子邮件。我得到以下错误:

: Warning
Message: fsockopen(): php_network_getaddresses: getaddrinfo failed:Name or service not known

Filename: libraries/Email.php

Line Number: 1986

Severity: Warning

Message: fsockopen(): unable to connect to ssl://smtp.123mailsetup.com:25   (php_network_getaddresses: getaddrinfo failed: Name or service not known)

Filename: libraries/Email.php

   Line Number: 1986
我的路线是

$this->smtp_timeout);
我的控制器中的部分代码

$config = Array(
'protocol' => 'smtp',
'smtp_host' => 'smtp.xxxx.com',
'smtp_port' => 465,
'smtp_user' => 'xxxxx@xxx.com',
'smtp_pass' => 'xxxxxxxx',
'mailtype'  => 'html', 
'charset'   => 'iso-8859-1'
);
                $this->load->library('email', $config);
                $this->email->from('xxxxx@xxx.com', 'Mailsetup');
                $this->email->to($email); 

                $this->email->subject('Domain transfer');
                $this->email->message( '<html><body>Domain to be transfered        '.$domain.' <br> Domain owner '.$name.' , <br> email '.$email.'

                </body></html>' );   

                $this->email->send();
$config=Array(
'协议'=>'smtp',
“smtp_主机”=>“smtp.xxxx.com”,
“smtp_端口”=>465,
'smtp_用户'=>'xxxxx@xxx.com',
“smtp_pass”=>“xxxxxxxx”,
“邮件类型”=>“html”,
“字符集”=>“iso-8859-1”
);
$this->load->library('email',$config);
$this->email->from($this)xxxxx@xxx.com“,”邮件设置“);
$this->email->to($email);
$this->email->subject('Domain transfer');
$this->email->message('Domain to transfered'.$Domain'.
域所有者'.$name'.,
email'.$email' ' ); $this->email->send();
使用PHP邮件程序


如果主机名不能通过DNS解析,则可以使用IP作为主机名。注意,尝试ping smtp.123mailsetup.com显示它没有解析,但123mailsetup.com确实解析为77.235.54.121验证电子邮件服务器的名称谢谢。这就是问题所在。已设法解决它
$mail = new PHPMailer(true);

$auth = true;

if ($auth) {
  $mail->IsSMTP(); 
  $mail->SMTPAuth = true; 
  $mail->SMTPSecure = "ssl"; 
  $mail->Host = "smtp.xxxx.com"; 
  $mail->Port = 465; 
  $mail->Username = "username@host.com"; 
  $mail->Password = "xxxxxxxxxxxx"; 
}

$mail->AddAddress("xxxxxxxx@xxxxxx.com");
$mail->SetFrom("JohnDeo@xxx.com", "John Deo");
$mail->isHTML(true);
$mail->Subject = "Test Email";
$mail->Body = "Hello World";

try {
  $mail->Send();
  return true;
} catch(Exception $e){
  echo $mail->ErrorInfo;
}