Post by matthewcoatney » Sat Oct 21, 2017 12:30 am

I have had an error for a while which would not send emails. I have gone over this both with my host and here. I finally resolved part of it. If I use the MAIL engine as opposed to SMTP it sends mail and there is no more error. But I am concerned that MAIL will cause the emails to be SPAM and want to figure out how to get SMTP working.

I am capable of changing/adding code if I need to.

(Please note these setttings work with the MAIL engine)
Engine: SMTP
PARAM: -fmatthew@anewcreationgreetings.com
HOST: ssl://gator4161.hostgator.com
PORT: 465
T/O: 5

This is a connection error, but the host is correct and all the ports work ssl is setup etc. Here is the error:

Code: Select all

Warning: fsockopen(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /home4/cmatthewc/public_html/system/library/mail/smtp.php on line 87Warning: fsockopen(): unable to connect to ssl://gator4161.hostgator.com :465 (php_network_getaddresses: getaddrinfo failed: Name or service not known) in /home4/cmatthewc/public_html/system/library/mail/smtp.php on line 87
Fatal error: Uncaught exception 'Exception' with message 'Error: php_network_getaddresses: getaddrinfo failed: Name or service not known (0)' in /home4/cmatthewc/public_html/system/library/mail/smtp.php:90 Stack trace: #0 /home4/cmatthewc/public_html/system/library/mail.php(142): Mail\Smtp->send() #1 /home4/cmatthewc/public_html/catalog/controller/mail/register.php(44): Mail->send() #2 [internal function]: ControllerMailRegister->index('account/custome...', Array, 5) #3 /home4/cmatthewc/public_html/system/engine/action.php(79): call_user_func_array(Array, Array) #4 /home4/cmatthewc/public_html/system/engine/event.php(62): Action->execute(Object(Registry), Array) #5 /home4/cmatthewc/public_html/system/engine/loader.php(255): Event->trigger('model/account/c...', Array) #6 [internal function]: Loader->{closure}(Array, Array) #7 /home4/cmatthewc/public_html/system/engine/proxy.php(47): call_user_func_array(Object(Closure), Array) #8 /home4/cmatthewc/public_html/catalog/controller/account/register.php(22): Proxy->__call('addCu in /home4/cmatthewc/public_html/system/library/mail/smtp.php on line 90

So, line 90 is a connection failure obviously. The code below gives the basic region in question. Line 90 is throwing an exception. Why would MAIL work fine and SMTP not? Please note I have gone over every conceivable configuration with the Host tech support and they are convinced it is OpenCart (might still be Host Gator but I digress...)

Code: Select all

if (substr($this->smtp_hostname, 0, 3) == 'tls') {
			$hostname = substr($this->smtp_hostname, 6);
		} else {
			$hostname = $this->smtp_hostname;
		}

		$handle = fsockopen($hostname, $this->smtp_port, $errno, $errstr, $this->smtp_timeout);

		if (!$handle) {
			throw new \Exception('Error: ' . $errstr . ' (' . $errno . ')');
		} else {


Posts

Joined
Wed Sep 13, 2017 7:31 am

Post by yodapt » Sat Oct 21, 2017 2:24 am

mail function doesnt use SMTP settings, so those credentials are never used and the issue must be about them. I suggest you try those credentials with a mail client first.

Opencart Developer - My Extension Showcase
Contact me at aeon.yoda@gmail.com


User avatar
Active Member

Posts

Joined
Fri Jun 17, 2011 6:39 pm

Who is online

Users browsing this forum: No registered users and 8 guests