Tengo el siguiente código en una aplicación y me salta la siguiente excepción: 'Socket Error # 10049 Cannot assign requested addres.'
El error se produce en: SMTP.Connect(5000);
Como dato, he intentado con el servidor de gmail, yahoo y uno de pago. Creo que el fallo lo da mi ordenador y no el servidor (da el error inmediatamente).
SMTP es un componente TIdSMTP e IdEmail es un TIdMessage. No tengo ningún otro componente de comunicación en la aplicación.
Código Delphi
[-] with SMTP do
begin
AuthenticationType := atLogin;
Username := EdNombreUsr.Text;
Password := EdPWD.Text;
Host := EdServidorSMTP.Text;
Port := EdPuertoSMTP.IntValue;
end;
for i := 0 to 6 do
begin
Email := Lista[i+1].Email;
with IdEmail do
begin
Body.Add(TEXTO1 + Lista[i+2].Nombre);
Body.Add(TEXTO2);
From.Text := 'XXXXX@gmail.com';
Recipients.EMailAddresses := Email;
Subject := 'XXXXXXX';
Priority := TidMessagePriority(mpHighest);
end;
SMTP.Connect(5000);
try
SMTP.Send(IdEmail);
finally
SMTP.Disconnect;
end;
end;
He probado a desactivar el firewall de windows pero sigue fallando. A ver si alguien me puede dar una solución.
Un saludo y gracias