phpmailer network is unreachable - networking

Some of the times trying to send email through php web application I'm getting "smtp connection failed", and some other times it works perfectly without throwing any exceptions.
The app is under the same configuration as always ( "smtp.gmail.com", port: 587, protocol: TLS ). I beleive that the error it's triggered by a timeout as the gmail server does not response. I've noticed this irregular behaviour since last week or so. Any clues?
This is the response with "SMTPDebug = 3" enabled:
2017-02-02 16:19:36 Connection: opening to smtp.gmail.com:587, timeout=300, options=array (
)
2017-02-02 16:20:18 SMTP ERROR: Failed to connect to server: Network is unreachable (101)
2017-02-02 16:20:18 Connection: opening to smtp.gmail.com:587, timeout=300, options=array (
)
2017-02-02 16:21:02 SMTP ERROR: Failed to connect to server: Network is unreachable (101)
I've also tried adding "tls://" to the host address smtp.gmail.com, as suggested in other tread with no success...
thanks in advance

Related

sshd connection issue: Connection reset by [ip] port x [preauth]

I'm seeing the following error messages when trying to sftp from a windows client to my redhat server:
Client:
C:\Users\Administrator\.ssh>sftp -P 7822 -v user#x.x.x.x
.
.
debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic
debug1: Next authentication method: publickey
debug1: Offering public key: RSA SHA256:FczboY8BDSWtdA87euFDWSDrwBNRMbYzHUR3VmMpbk
C:\\Users\\Administrator/.ssh/id_rsa
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic
debug1: Trying private key: C:\\Users\\Administrator/.ssh/id_dsa
debug1: Trying private key: C:\\Users\\Administrator/.ssh/id_ecdsa
debug1: Trying private key: C:\\Users\\Administrator/.ssh/id_ed25519
debug1: Trying private key: C:\\Users\\Administrator/.ssh/id_xmss
debug1: No more authentication methods to try.
user#x.x.x.x Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
Server:
Aug 4 23:27:09 3oy1jxwr1k81l.xxx.io sshd[16064]: Connection reset by x.x.x.x port 65256 [preauth]
Aug 4 23:27:14 3oy1jxwr1k81l.xxx.io sshd[16117]: Did not receive identification string from x.x.x.x port 12593
Aug 4 23:27:24 3oy1jxwr1k81l.xxx.io sshd[16259]: Did not receive identification string from x.x.x.x port 48329
Aug 4 23:27:34 3oy1jxwr1k81l.xxx.io sshd[16394]: Did not receive identification string from x.x.x.x port 2040
I'm positive that all ports open in firewall, and authorized_keys are setup up correctly.
So i stop the sshd service, and run from cmd line with -ddd hoping to get more information.
However when running in debug mode, the connection succeeds !?!?
/user/sbin/sshd -D -ddd
Client:
C:\Users\Administrator\.ssh>sftp -P 7822 user#x.x.x.x
Connected to user#x.x.x.x.
sftp> exit
Any ideas what could be happening? (Note this is 100% reproducible, fails every time when sshd is run normally, and succeeds always when run with -ddd)
So looks like the problem was due to a missing .bash_profile in the user home dir on the server.
After adding the user profile back, it seems to resolve the issue.
Why sshd didn't care it was missing when run in debug mode seems like a bug in sshd.
I was also getting the Connection reset by [ip] port x [preauth] message.
For me, however, it was a firewall issue on the client side. The IT department had blocked SSH outside the network. After updating the firewall, the connection worked.

Apache Atlas and Airflow Integration

I am trying to integrate an Apache Atlas instance I have running with Apache Airflow. Once I set up the connection in airflow.cfg I tried running a DAG from the Airflow scheduler. I get the following error in the log.
[2021-02-02 20:50:47,958] {connectionpool.py:752} WARNING - Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f464b856950>: Failed to establish a new connection: [Errno 111] Connection refused')': /api/atlas/v2/types/typedefs
[2021-02-02 20:50:47,960] {taskinstance.py:1150} ERROR - HTTPConnectionPool(host='localhost', port=21000): Max retries exceeded with url: /api/atlas/v2/types/typedefs (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7f464b8650d0>: Failed to establish a new connection: [Errno 111] Connection refused'))
My airflow.cfg is configured as the following:
[lineage]
backend = airflow.lineage.backend.atlas.AtlasBackend
[atlas]
username = <username>
password = <password>
host = localhost
port = 21000
I have tried changing the host to http://localhost as well. I am not sure where to investigate in Atlas to identify why the connection is being refused.
Connection Refused means either service is not listening on the configured port or the wrong hostname.
Try to replace localhost to fqdn,
A good way to configure it correctly is to access atlas ui and simply put the hostname from the url to config.
I was able to solve the problem by adding the --hostname flag when starting the docker container for atlas. I then used the hostname I provided as the host in airflow.cfg

PHPMailer: Error number 2. "Error notice: stream_socket_client()

I am getting the following error (using the WP Mail SMTP Plugin).
Any idea how to resolve this?
(All ports, passwords, etc are correct)
Thanks
Versions:
WordPress: 4.9.1
WordPress MS: No
PHP: 5.6.31-4+wpengine10
WP Mail SMTP: 1.2.2
Params:
Mailer: smtp
Constants: No
ErrorInfo: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
Host: smtp.hosts.co.uk
Port: 465
SMTPSecure: ssl
SMTPAutoTLS: bool(false)
SMTPAuth: bool(true)
Server:
OpenSSL: Yes
SMTP Debug:
2018-01-15 15:54:32 Connection: opening to ssl://smtp.hosts.co.uk:465, timeout=300, options=array ()
2018-01-15 15:54:39 Connection: Failed to connect to server. Error number 2. "Error notice: stream_socket_client(): unable to connect to ssl://smtp.hosts.co.uk:465 (Connection timed out)
2018-01-15 15:54:39 SMTP ERROR: Failed to connect to server: Connection timed out (110)
2018-01-15 15:54:39 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
It looks like your ISP is blocking outbound SMTP. How to diagnose this is covered in the troubleshooting guide linked from the error message.
I can get to your host on that port, so it's definitely an issue with your network, not your code. You should ask your ISP or read their support docs about how they want you to send email.

wp-mail-smtp in wordpress Connection refused (111)

I developed my site with WordPress 4.5.3.I installed plugin WP-Mail-SMTP.I create mail account with my host tigrimigri.com.
with this setting
Secure SSL/TLS Settings
Username: Your Email Address
Incoming Server: freehost.tigrimigri.com
IMAP Port: 993
POP3 Port: 995
Outgoing Server: freehost.tigrimigri.com
SMTP Port: 25
Then I write this info at plugin WP-Mail-SMTP setting
But when I test email I get this error
The SMTP debugging output is shown below:
2016-07-02 12:21:04 Connection: opening to ssl://freehost.tigrimigri.com:25, timeout=300, options=array (
)
2016-07-02 12:21:04 SMTP ERROR: Failed to connect to server: Connection refused (111)
2016-07-02 12:21:04 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
Please anyone help me.
I think you can not sent mail through freehost.tigrimigri.com
Check the faq section on the site:
http://tigrimigri.com/faq.html
Can I use e-mail?
Sorry it is not possible yet to sent / receive e-mail through our server.

Digital Ocean and GMAIL smtp server give error

I am using Symfony2 on Digital Ocean Ubuntu 12.04.5 LTS (GNU/Linux 3.2.0-24-virtual i686).
Everything is working on my localhost, but do not work on Digital Ocean Server,
Here is error message when I try to register user in my web with Activation Email enabled :
Connection could not be established with host smtp.gmail.com [Connection timed out #110]
500 Internal Server Error - Swift_TransportException
and error stacktrace :
$this->_stream = #stream_socket_client($host.':'.$this->_params['port'], $errno, $errstr, $timeout, STREAM_CLIENT_CONNECT, stream_context_create($options));
if (false === $this->_stream) {
throw new Swift_TransportException(
'Connection could not be established with host '.$this->_params['host'].
' ['.$errstr.' #'.$errno.']'
);
Output from server terminal :
yusuf#xwzxc:~$ telnet smtp.gmail.com 465
Trying 74.125.130.108...
Trying 74.125.130.109...
Trying 2404:6800:4003:c01::6c...
telnet: Unable to connect to remote host: Network is unreachable
any help will be greatly appreciated.
Thanks
In order to curb spam and abuse, some new user accounts at DigitalOcean have their SMTP ports blocked by default. Unfortunately there are sometimes false positives. It sounds like this might have been the case for you. If you open a support ticket, the team would be happy to remove that block for you
As a temporary solution I have changed the smtp.gmail.com by the IP
You can get the IP by: ping smtp.gmail.com on the command line.

Resources