Page 1 of 1

Error sending mail

Posted: Tue Oct 17, 2017 1:04 am
by matthewcoatney
I cannot get OpenCart to send an email. Every function where it should send an email fails with this 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 anewcreationgreetings.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, 2) #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
Emails are not sent but (so far) whatever else needs to happen works. For instance, your new account will be created, but you will not get an email and you will get an ugly error and not be told that your account was successfully created. This is also true for buying products. You aren't even told that your purchase went through, you just get an ugly error.

You can recreate this by trying to make an account here:
https://anewcreationgreetings.com/index ... t/register


I really need to get this fixed so please advise and thanks so much, in advance, for your help!

Re: Error sending mail

Posted: Tue Oct 17, 2017 2:26 am
by bumcarks
SMTP mail server is not configure. Please check your admin->system->setting->edit store and check mail tab.
this type of error resolved in
https://stackoverflow.com/questions/400 ... vice-not-k

Re: Error sending mail

Posted: Thu Oct 19, 2017 6:12 am
by matthewcoatney
As far as I can tell I DO have the settings configured. I got on chat with the host tech support and they said I had everything configured correctly and I needed to contact OpenCart. I have tried several configurations, here is what I am using right now (that is not working)

Mail Engine: SMTP
Mail Parameter -fmatthew@anewcreationgreetings.com
SMTP Hostname: ssl://mail.anewcreationgreetings.com
SMTP Username: matthew@anewcreationgreetings.com
Pass: ****
SMTP Port: 465
timeout: 5



And I get 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://mail.anewcreationgreetings.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, 3) #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

Re: Error sending mail

Posted: Thu Oct 19, 2017 6:15 am
by straightlight
See if this demonstration is working for you but by entering your configurations: viewtopic.php?t=87368#p542817

Re: Error sending mail

Posted: Thu Oct 19, 2017 10:53 pm
by matthewcoatney
Thanks for your help, but I already saw that post and my current settings are using that advice (but with my credentials)

Re: Error sending mail

Posted: Thu Oct 19, 2017 10:59 pm
by straightlight
Instead of using ssl:// , use tls:// with port 587 instead of 465 and see if that resolves the issue.

Re: Error sending mail

Posted: Fri Oct 20, 2017 4:43 am
by matthewcoatney
Went over and over this with host again. They concluded (again) its something in the codebase.

We tried every configuration we could think of and got the same error...until I switch the engine to MAIL.

Now I can send mail, but it tells me I am sending 0 messages of (whatever #). I don't know if that will matter later but for now I'm glad to be sending mail.

I still don't understand why SMTP would not work.

Re: Error sending mail

Posted: Sat Oct 21, 2017 5:05 am
by matthewcoatney
I switched over to GSuite and now have SMTP working but now I'm having other related issues. Ill post elsewhere.

I am using Hostgator. If you are having trouble getting SMTP working I suggest switching to Gmail.