Home:ALL Converter>Codeigniter not connecting to my SMTP server

Codeigniter not connecting to my SMTP server

Ask Time:2012-05-25T13:26:49         Author:Zen

Json Formatter

For some reason CodeIgniter is not connecting to my SMTP server, anyone have any problems surrounding this?

$config['protocol'] = 'smtp';
$config['smtp_host'] = 'smtp.netregistry.com.au';
$config['smtp_port'] = '465';

A PHP Error was encountered

Severity: Warning

Message: fsockopen(): unable to connect to smtp.netregistry.com.au:465 (php_network_getaddresses: getaddrinfo failed: Name or service not known)

Filename: libraries/Email.php

Line Number: 1689

Should I be using the SSL or non-SSL port? (I've tried both; no dice)

Is there a way of explicitly telling CI to use SSL or not?

Am I doing anything blaringly wrong here?

Thanks

Author:Zen,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/10748904/codeigniter-not-connecting-to-my-smtp-server
Keith Bateup :

You could try putting ssl: in the host address:\n\n$config['smtp_host'] = 'ssl://smtp.netregistry.com.au';\n$config['smtp_port'] = '465';\n\n\nQuite often smtp hosts have security in place that prevents this kind of use. Have you tried using a gmail account? That does work for me, here is how I use it:\n\nfunction send_email($attributes) {\n\n $this->load->library('email');\n\n $this->email->set_newline(\"\\r\\n\");\n\n $config['protocol'] = 'smtp';\n $config['smtp_host'] = 'ssl://smtp.googlemail.com';\n $config['smtp_port'] = '465';\n $config['smtp_user'] = '[email protected]';\n $config['smtp_from_name'] = 'FROM NAME';\n $config['smtp_pass'] = 'XXX';\n $config['wordwrap'] = TRUE;\n $config['newline'] = \"\\r\\n\";\n $config['mailtype'] = 'html'; \n\n $this->email->initialize($config);\n\n $this->email->from($config['smtp_user'], $config['smtp_from_name']);\n $this->email->to($attributes['to']);\n $this->email->cc($attributes['cc']);\n $this->email->bcc($attributes['cc']);\n $this->email->subject($attributes['subject']);\n\n $this->email->message($attributes['message']);\n\n if($this->email->send()) {\n return true; \n } else {\n return false;\n } \n\n\n}",
2012-05-25T07:54:28
Zen :

The smtp server was actually incorrect.",
2012-05-25T05:39:43
Karun S. :

From the error, it said \"getaddrinfo failed: Name or service not known\".\nAnd the function php_network_getaddresses shoots the error.\n\nThat might means your SMTP server is behind your company gateway, or is a private server. \n\nSo, that results in fsockopen() doesn't seem to find your SMTP server.\n\nTry to run your code again in your company, that should work then.",
2012-05-25T05:36:30
yy