Search code examples
phpemailsmtpphpmailersmtp-auth

Connection error with PHPMailer and SMTP: node name or service name not known


I'm using PHPMailer to generate mails in PHP (PHP Version 5.3.7). But I have tried it again and again, but PHPMailer doesn't work with the settings from my provider but with my gmail account. My settings:

SMTP = true
SMTPAuth = true
CharSet = UTF-8
SethSecure = ""
Host = smtp.strato.de
User = myemail
Password = **********
port = 587

But PHPMailer returns the following messages (in debug mode):

SMTP -> ERROR: Failed to connect to server: php_network_getaddresses: getaddrinfo failed:
node name or service name not known (0)
The following From address failed: [email protected] : Called Mail() without being connected

Please help me due to I don't know what has caused this error and why?


Solution

  • It sounds like your DNS server is not resolving smtp.strato.de. Try opening a command prompt on your server, and typing:

    nslookup smtp.strato.de
    

    Does it resolve? If not, try using a different DNS server (by change /etc/resolve.conf). It does in fact resolve on a server that I tested from.