Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
TIdSMTPServer - Questions (differences between v9 and v10)
#1
Hi,

Moons ago I was writing a smtp server in v9. V9 rocked, the event handlers (via the object inspector) made it nice and easy to use but there was some architectural bug in it involving the dots - from memory it needed two dots on some lines for some reason.. Anyway eventually i setup another machine with v10, had a newborn son, forgot all about it...

9 odd years later.. I'm back on this project..

I'm using 10.2.3

So with the online documentation being down on ww2.indyproject.org, I'm kind of flying blind. To get started, I double clicked all the events in object inspector and put in a ShowMessage() so that i knew what order they fire in (yes I had exceptions regarding drawing - but it got me what i needed after multiple program resets).

So I have these in this order (I'm manually typing these in - can't copy from the VM - sorry for any typo's but you'll get the idea):

procedure TDataModule1.IdSMTPServer1.Connect()
procedure TDataModule1.IdSMTPServer1BeforeCommandHandler()
TDataModule1.IdSMTPServer1Reset()
IDSMTPServer1SPFCheck()
IdSMTPServer1AfterCommandHandler()
IdSMTPServer1UserLogin()
IdSMTPServer1MailFrom()
IdSMTPServerRcptTo()
IdSMTPServer1Received()
IdSMTPServer1MsgReceive()
IdSMTPServer1Disconnect()

That all seems relatively straight forward however I'm having problems with SPFCheck(). My client (Outlook express - yes it's old but ok for testing) sends my machine name (Asuras) which obviously isn't a domain and as it's a SMTP client, not another SMTP server, that obviously won't resolve. I suspect a connecting server will send a domain?

So how do I proceed with this? - obviously if another server connects then the SPFCheck is a great idea but if it's a client then I'm in a fix and it will fail (as a bodge I'm using "If Pos('.', ADomain) then.." to test for a domain). Will IdSMTPServer cause a disconnect / client abort if I use spfNone / spfNeutral or will it just continue?

EG I'm with yahoo. If my email client were to connect to them, it would send "HELO/EHLO Asuras". Based on the indy logic, Asuras means nothing to Yahoo and so it would probably perform a spfCheck against my IP. My IP is part of my ISPs network and thus Yahoo has nothing to pass or fail me with until I login - but in the sequence above, that comes two events later.

Also if a SMTP client connects, it has to send a username and password. How do SMTP servers communicate mail to each other without this? - As the sequence above suggests it seems like a inbound connection has got to login first before it can specify the MailFrom details and trigger that event. How can I know in the UserLogin() event that the connecting user will be sending to a local address in order that I can set VAuthenticated := True ? - those details don't come through until RcptTo()!!

AThread has vanished.. now we have AContext. Whats the difference here? Presumably they still run like threads?

Oh one other thing, whats IdSMTPRelay all about?

Thanks for your time,

JC
Reply


Messages In This Thread
TIdSMTPServer - Questions (differences between v9 and v10) - by Justin Case - 07-09-2024, 06:04 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)