Skip to main content

SMTP Connection From (localhost) Closed By QUIT

Comments

12 comments

  • GOT
    Your logs indicate you are trying to connect to localhost as its the localhost reporting the authentication failure. Are you running CSF? What is the setting for smtp_redirect set to if so?
    0
  • MichaelEC
    Your logs indicate you are trying to connect to localhost as its the localhost reporting the authentication failure. Are you running CSF? What is the setting for smtp_redirect set to if so?

    Hi Got, We aren't running CSF as far as I can see (Under the Plugins section on WHM right?)
    0
  • MichaelEC
    Just bumping this for more options! I'd assume something needs to be configured to stop trying to connect to localhost when running the PHP Mail script? Here's my PHP Script using Gmail SMTP; [PHP]$host = "smtp.gmail.com"; $username = "test@test.com"; $password = "redacted"; $port = "587"; $to = "test@test.com"; $email_from = "test@test.como"; $email_subject = "Email To All People" ; $email_body = "Something Something Something" ; $email_address = "test@test.com"; $headers = array ('From' => $email_from, 'To' => $to, 'Subject' => $email_subject, 'Reply-To' => $email_address); $smtp = Mail::factory('smtp', array ('host' => $host, 'port' => $port, 'auth' => true, 'username' => $username, 'password' => $password)); $mail = $smtp->send($to, $headers, $email_body); if (PEAR::isError($mail)) { echo("

    " . $mail->getMessage() . "

    "); } else { echo("

    Message successfully sent!

    "); };[/PHP]
    0
  • cPanelLauren
    Hi @MichaelEC It looks like you're using local credentials for the mail [QUOTE]test@test.com
    you should be using your full gmail address or google apps address. If you're using the latter you need to ensure that the domain is put into /etc/remotedomains
    and removed from /etc/localdomains
    as it appears it's trying to authenticate with test@test.com locally.
    0
  • MichaelEC
    Hi Lauren, Thanks for the response. test@test.com is actually just a placeholder, I'm using a Google Suite address which is info@company.io I've just had a look at localdomains and its only got two lines in it called server.company.io & XXXX.XXXX001.local In remotedomains there's also only one line called company.io (company is a placeholder for company name & XXXX replaces a string of characters) Not sure what I must do here!
    0
  • cPanelLauren
    Hi @MichaelEC The question is about the domain you're using google apps with. If that domain is hosted on the server you need to add it to /etc/remotedomains or the server will continue to attempt to authenticate it locally which will continue to fail.
    0
  • MichaelEC
    Hi @MichaelEC The question is about the domain you're using google apps with. If that domain is hosted on the server you need to add it to /etc/remotedomains or the server will continue to attempt to authenticate it locally which will continue to fail.

    Hi @cPanelLauren, I get you, thanks. Unfortunately our domain is already in /etc/remotedomains - it's the only line in the file.
    0
  • Sunday Alabi
    Currently also having issues with sending mails out. I am using Docker for magento. Sending mails from cpanel works, but sending mails from magento does not work with error message on whm `Rejected relay attempt: '127.0.0.1' From: 'emailfrom@example.com' To: 'emailto@example.com'`
    0
  • cPanelLauren
    Hi @MichaelEC Good that it's in remote domains just to be sure it's not also listed in localdomains correct? Without being able to see the configuration it's really hard to tell what's going wrong with the authentication. If you'd like to, please open a ticket using the link in my signature? Once open please reply with the Ticket ID here so that we can update this thread with the resolution once the ticket is resolved. Thanks!
    0
  • MichaelEC
    Hi @cPanelLauren It is also listed in localdomains. I have an open ticket now, the number is 11333509. There are some suggestions from that ticket for me to try so I'll get those actioned sometime tomorrow or Friday, hopefully one of them works!
    0
  • cPanelLauren
    Hi @MichaelEC You also most likely need to remove it from /etc/localdomains or it's going to continue to attempt to authenticate locally. I'll check in on the ticket as well. Thanks!
    0
  • poliet
    I had the same error. For reference and others, here are the steps how I resolved it: 1. Need to allow less secure apps in your google admin (https://myaccount.google.com/u/5/apppasswords) to bypass Google security concerns and 2-factor auth issues. You must use the newly created app specific password instead of your regular login gmail $password. 3. Try to send mail, which is likely to be blocked by a Captcha. Clear the captcha (SMTP relay: Route outgoing non-Gmail messages through Google - Google Workspace Admin Help).
    0

Please sign in to leave a comment.