Reputation: 345
I have here a little handy smtp test script in python. nothing special, just basics. it works on all of my server or my desktop workstations. but on one server i am not able to connect to the remote smtp. instead it always tries to connect to the local smtp.
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
import smtplib,string,datetime,time
MESSAGE = MIMEMultipart('alternative')
MESSAGE['subject'] = "TEST"
#MESSAGE['TO'] = to
# FOR TESTING ONLY
MESSAGE['TO'] = '[email protected]'
# FOR TESTING ONLY
MESSAGE['FROM'] = 'Me <[email protected]>'
HTML_BODY = MIMEText('<p>Hi this is a test</p>','html')
MESSAGE.attach(HTML_BODY)
server = smtplib.SMTP("gator3124.hostgator.com:587")
server.set_debuglevel(1)
server.login("username","password")
server.sendmail(MESSAGE['from'],[MESSAGE['to']],MESSAGE.as_string())
server.quit()
I execute this script (of course change the username,password etc...) i get the following ouput:
send: 'ehlo h37-157-247-18.host.redstation.co.uk\r\n'
reply: '250-h37-157-247-18.host.redstation.co.uk Hello h37-157-247-18.host.redstation.co.uk [37.157.247.18]\r\n'
reply: '250-SIZE 52428800\r\n'
reply: '250-8BITMIME\r\n'
reply: '250-PIPELINING\r\n'
reply: '250-AUTH PLAIN LOGIN\r\n'
reply: '250-STARTTLS\r\n'
reply: '250 HELP\r\n'
reply: retcode (250); Msg: h37-157-247-18.host.redstation.co.uk Hello h37-157-247-18.host.redstation.co.uk [37.157.247.18]
SIZE 52428800
8BITMIME
PIPELINING
AUTH PLAIN LOGIN
STARTTLS
HELP
send: 'AUTH PLAIN xxxx =\r\n'
reply: '535 Incorrect authentication data\r\n'
reply: retcode (535); Msg: Incorrect authentication data
The script tries to open a connection to the local machine and ignores the host in the script. this only happens on this machine. i can enter what i want as a host, does not matter.
EDIT: Really interessting is that i can execute the script successfully as root. but as a "normal" ssh user it connects to localhost..
Upvotes: 0
Views: 1005
Reputation: 12814
This error is commonly seen with mailbox file permissions in cPanel. Root access is required to correct this issue. This might happen when the option “Allow mail account authentication using the password of the domain owner’s account” in WHM -> Server Configuration -> Tweak Settings is enabled. Disable this option and try again.
Because your server is open to the Internet to accept mail from anywhere in the world, this also means that anyone in the world can attempt to try to login and send mail as one of your email addresses. Just be careful, this change will redirect outgoing SMTP connections allow accounts to make direct connections which may increase the chance of your server be in blacklists.
Upvotes: 1