07-16-2024, 11:38 AM
(This post was last modified: 07-16-2024, 02:33 PM by Justin Case.)
Hi again,
Just wondering.. in v10, there is a RcptTo event:
IdSMTPServer1RcptTo(ASender: TIdSMTPServerContext; const AAddress: String; AParams: TStrings; var VAction: TIdRCPToReply; var VForward: String);
I've got that one coded up, if the AAddress is local, it's accepted, if it's external it's only accepted if the user is logged in (pluis a few other checks). Oh and I have SPF fully implemented checking TXT (parsing a, mx, include: ), A records and MX..
However, then I hit a snag...
IdSMTPServer1MsgReceive(ASender: TIdSMTPServerContext; AMsg: TStream; var VAction: TIdDataReply);
EEeeeek!
So, I've done:
Msg := TIdMessage.Create;
Msg.LoadFromStream(AMsg);
But now I am stuck with a new problem... who is it TO?
ASender.RCPTList.EMailAddresses (and similar under ASender.RCPTList) !!!
But there could be many there.. how do I know which one I approved earlier in RcptTo? - I could use a variable somewhere but I kinda thought it would be made available in the parameters!
It looks like I need to loop through the items and process every single address all over again to determine if it's ok or a fail. Is that correct or am I missing something? Should I just call the RcptTo event on each address?
Obviously if it's an outgoing mail I guess that's straight forward but if it's incoming for a local user and there's lots of addresses in there that is gonna require more cpu cycles right?
Just wondering.. in v10, there is a RcptTo event:
IdSMTPServer1RcptTo(ASender: TIdSMTPServerContext; const AAddress: String; AParams: TStrings; var VAction: TIdRCPToReply; var VForward: String);
I've got that one coded up, if the AAddress is local, it's accepted, if it's external it's only accepted if the user is logged in (pluis a few other checks). Oh and I have SPF fully implemented checking TXT (parsing a, mx, include: ), A records and MX..
However, then I hit a snag...
IdSMTPServer1MsgReceive(ASender: TIdSMTPServerContext; AMsg: TStream; var VAction: TIdDataReply);
EEeeeek!
So, I've done:
Msg := TIdMessage.Create;
Msg.LoadFromStream(AMsg);
But now I am stuck with a new problem... who is it TO?
ASender.RCPTList.EMailAddresses (and similar under ASender.RCPTList) !!!
But there could be many there.. how do I know which one I approved earlier in RcptTo? - I could use a variable somewhere but I kinda thought it would be made available in the parameters!
It looks like I need to loop through the items and process every single address all over again to determine if it's ok or a fail. Is that correct or am I missing something? Should I just call the RcptTo event on each address?
Obviously if it's an outgoing mail I guess that's straight forward but if it's incoming for a local user and there's lots of addresses in there that is gonna require more cpu cycles right?

