May 14th, 2003, 08:36 PM
localhost mailer logs me into POP an stil refuses SMTP
This isnt a security app but falls into networking.
I have a bit of a delma here I was woundering if I can get some guidence. For a discusion form I am makeing, a visitor who applys to join will recieve either an aproval or denal message in email simular to what hapens here at antionline. The script is complete except for the mail part of it. I can mail to a local address like journy101@localhost but not external without POP auth which si normal and what I want to prevent spammers. However to send my mails to an exteral as needed by my particular application I would need to loging to POP first with USER PASS then conect to 25 and issue my SMTP commands. Is this corect?
When I do this my mail server acepts my username and password, and reponds with +OK mailbox locked and ready. That indicates my POP has loged me in. But now when I try to send my mail is when I get user not local:
This is when I get my 550 user not local, previous to issueing the mail command I create and open a socket conection to localhost on port 110, I issue my USER and PASS to get logged in. Would this be the corect way of doing this? If instead of mail I open a second socket conection to 25 and issue SMTP same thing hapens user not local.
Mail relay is set to enable on the condition the user logs into POP first, then SMTP as a requirement for authentication so spammers dont bounce messages off my server.
I am stumpted with this. I have downloaded a bunch of code examples, searched google. asked questions on various message boards.
If i set the from as a local address and to as the external same thing. but if i set to as a local then it is aproved and acepted for delevery. I think this is normal because you need POP AUTH fiorst, but in my case Ive already logged into POP. So I should be able to send my SMTP?
Can someone please give me some guidence?
May 14th, 2003, 08:46 PM
Can't you either:
- Allow relaying from localhost unconditionally (assuming no spammers on the local host; if they are then you've got problems anyway)
- Send mail by having php invoke sendmail (or other MTA) directly. This is the default behaviour if /usr/bin/sendmail was available when php was built. (this assumes unix-like system)
May 14th, 2003, 09:14 PM
I did enable relay from my config but only for local users sending to other local users, then if going to a exteral domain requires SMTP authentification but only by loging into POP first.
In telnet I tryed
it gives me 502 Unknown command
I think because the autnetification has to be on POP first, if I send to a local address im fine. There are spoammers here localy but if I alow to send mail without AUTH to external domains then Im afraid i would become an open relay.
I found this link http://www.faqts.com/knowledge_base/...id/9820/fid/21
For How do I send e-mail using the mail() function if the mail server requires SMTP authentication?
and that says tu use AUTH LOGIN but as you see my server dont suport that comand.
Any more sugestions?
May 14th, 2003, 09:34 PM
what smtp server are you running, and is the code running on the same system as your mail server? i am guessing a big no to the second question as you need POP which is a remote mail thing. Perhaps you could load a SMTP server on the system the program is running on, then you could invoke sendmail "or whatever" directly insted of useing the mail function.
Who is more trustworthy then all of the gurus or Buddha’s?
May 14th, 2003, 09:44 PM
The server Im running, Argosoft Mail Server freeware. Yes the script is runing on the same machine as the mail server. My web server is also on the same machine.
In my config settings, I first checked to enable relay, then under SMTP AUTH I checked two boxes
Enalbe SMTP Atuhentification and
Use POP3 usernames and passwords.
I just tryed unchecking useing POP3 usernames and passwords, and just useing SMTP AUTH, and entered the username and password for that then reset the server.
AUTH LOGIN and AUTH-LOGIN
both still give me Unkown Command. But I found if I
EHLO instead of HELO
but then entering either journy101 or user jopurny101 drops the coenection. Conection closed by remote server.
May 14th, 2003, 10:08 PM
If its on the same system you shouldn't use POP. You should be able to connect to the mail server directly with out sending a HELO or EHLO , or loging in as that is all remote stuff... what OS is this running on?
Who is more trustworthy then all of the gurus or Buddha’s?
May 15th, 2003, 02:29 AM
Im, useing Windows 98. I can telnet to localhost on 25 and am abvle to send my emails to local users like journy101@localhost but when trying to send to an external domain is when it says im not local. Ive sucessfuly maid my php mail scripts before when sending only to my local address.
Should I provide a sniplet of my mnail code with server output?
I think my mial server behaves they way all servers do. If i set an acount in outlook on incomeing and outgoting localhost, i can login and send and recieve to anyone includeing my hotmail acounts. I guess what I need to know, would outlook not do the same thing, open a socket to 110, login and transfer SMTP commands?
May 15th, 2003, 03:47 AM
Got it working!!!!!!!
I setup outlook and watched what it did and I found my mistake, after EHLO anon, AUTH USEr I must base64 encode both username and password
When i did it in telnet i was typeing my username and pass in plain text. So now when I use the base64encode it works!!!!!!
$handle = fsockopen($smtp_server,$port);
fputs($handle, "EHLO $mydomain\r\n");
// SMTP authorization
fputs($handle, "AUTH LOGIN\r\n");
May 15th, 2003, 04:48 AM
argosoft does not require base64 encoding, plain text is fine, but where you were making your mistake was by logging into the pop server. The smtp server can be set to use the same username and password as the pop but loging into your pop account doesnt carry over to an smtp session. you must log into the smtp server itself. This your doing in the code you posted it has nothing to do with the encoding.
Bukhari:V3B48N826 “The Prophet said, ‘Isn’t the witness of a woman equal to half of that of a man?’ The women said, ‘Yes.’ He said, ‘This is because of the deficiency of a woman’s mind.’”
May 15th, 2003, 07:15 AM
I thought it was the base 64 because once i realized i could AUTH LOGIN (new command to my vocabulary) I tryed it and by typeing journy101 imediatly the conection droped in telnet. But when I looked at what outlook did, I saw the my username and pass were being encoded. So when I tryed with the codes that outlook sent after the AUTH LOGIN, i got in.
base64encode is new to me, i discovered it a few days when learning about .htaccess and .htpasswds with my web server as I was trying to find ways of protecting directorys.
Im confused about the plain text, could it be that outlook uses base64 then? because when I watched outlook conect to my server what it entered after the AUTH LOGIN were not journy101 and my pass but funny codes, I used the same that outlook did but in telnet and it worked so I guessed it was prob base64. Working on my actual script right now, trying to find ways of geting around a conection reset by peer. seems after i open a socket and send data, i must gets before i can send again. But slowly i am learning.
Thank you all who helped me to track down my problem.