|Subject:||Creating SASLMechanisms at runtime?|
|Posted by:||Pete Royston (pete…@royston.com)|
|Date:||Sat, 27 Nov 2004|
Does anyone have an example of creating SASLMechanisms at runtime?
I am creating the TidSMTP at runtime, and want to use SASL, but the only
example I can find says "drop the following components on the form". I've
tried creating them by hand, but I am getting AVs when I run.
I have an ISAPI dll which I've been using for several years. It uses Indy
8 components to send mail. Each mail is spawned in a separate thread (got
the example from Shiv Kumar's website). Things went fine until I tried to
add BCCs. There was some problem in the Indy 8 code that caused it to fail
sending a BCC.
So I upgrade to 9.0 and I can't send mail at all, the exception raised was
a string of garbage characters.
So I upgraded to the latest 10.0 version, and things are working better.
It will authenticate (atDefault) but then it will not allow me to send any
email because it says "not local host xyz.com not a gateway".
If I send from the Indy 8 components it works fine. If I use the 10.0 I
get that error. If I call Authenticate after connect (with atDefault), then
DidAuthenticate returns true. I believe the mail server requires the from
name to match the web server domain (which it does).
So I am hoping that switching to SASL will solve the problem. But since
I'm creating everything dynamicaly, I'm having trouble getting that setup.
Any suggestions would be welcome. I've tried various cominations, like:
IdSASLEntries := TIdSASLEntries.Create(nil);
IdSASLCRAMMD5 := TIdSASLCRAMMD5.Create(nil);
IdUserPassProvider := TIdUserPassProvider.Create;
IdUserPassProvider.Password := 'thepw';
IdUserPassProvider.Username := 'theid';
IdSASLCRAMMD5.UserPassProvider := IdUserPassProvider;
with IdSASLEntries.Add do
SASL := IdSASLCRAMMD5;
IdSMTP.SASLMechanisms := IdSASLEntries;
But this AVs in the Authenticate routine.