Fórum Como usar vários SMTP no INDY-D7??? #287336
07/07/2005
0
O4pr3ndiz
Curtir tópico
+ 0Posts
07/07/2005
Massuda
... const SERVIDOR_SMTP: array[0..2] of string = ( ´smtp0.example.com´, ´smtp1.example.com´, ´smtp2.example.com´ ); var I: Integer; .... while not IdSMTP1.Connected do begin for I := Low(SERVIDOR_SMTP) to High(SERVIDOR_SMTP) do begin IdSMTP1.Host :=SERVIDOR_SMTP[I]; IdSMTP1.AuthenticationType := ... IdSMTP1.Username := ... IdSMTP1.Password := ... try IdSMTP1.Connect; Break; // conectou, pára o loop except if I = High(SERVIDOR_SMTP) then begin // não tem mais servidores, passa a exceção para frente raise; end; end; end; end; try ... IdSMTP1.Send(...); ... finally IdSMTP1.Disconnect; end; ...
Gostei + 0
08/07/2005
O4pr3ndiz
E mesmo q eu crie o usuario user2005 e a senha 123456 em 3 servers smpt diferentes ele so funcionou no smtp.mail.yahoo.com.br, no smtps.uol.com.br e smtp.bol.com.br naum..
:(
Gostei + 0
08/07/2005
Massuda
Gostei + 0
14/07/2005
O4pr3ndiz
Gostei + 0
09/08/2005
Christian_adriano
Vc pode usar de vetores, uma para os SMTPs , PASWORDs, LOGINs:
Ficaria mais ou menos assim:
... const SERVIDOR_SMTP: array[0..2] of string = ( ´smtp0.example.com´, ´smtp1.example.com´, ´smtp2.example.com´ ); PASSWORDs: array[0..2] of string = ( ´12345´, ´864596´, ´7845455xy´ ); LOGINs: array[0..2] of string = ( ´login1´, ´login2´, ´login3´ ); var I: Integer; .... while not(IdSMTP1.Connected) do begin for I := Low(SERVIDOR_SMTP) to High(SERVIDOR_SMTP) do begin IdSMTP1.Host :=SERVIDOR_SMTP[I]; IdSMTP1.AuthenticationType := ... IdSMTP1.Username := LOGINs[I]; IdSMTP1.Password := PASSWORDs[I]; try IdSMTP1.Connect; Break; // conectou, para o loop except if I = High(SERVIDOR_SMTP) then begin // não tem mais servidores, passa a exceção para frente raise; end; end; end; end; try ... IdSMTP1.Send(...); ... finally IdSMTP1.Disconnect; end; ...
Espero que ajude.
[]´s.
Christian.[/code]
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)