Erreur #10053 avec TIdSMTP
Bonjour,
J'utilise un code trouvé sur ce forum pour envoyer un courriel avec TIdSMTP.
J'ai juste changé mon host, Username et Password.
Je lance mon appli, et j'obtiens une erreur 10053 :
Code:
1 2 3
|
Exception class EIdSocketError with message 'Socket Error # 10053
Software caused connection abort.' |
J'ai essayé avec un autre serveur SMTP, et j'obtiens la même chose.
Voici le code que j'utilise:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
TIdEMailAddressList *obj_TIDRecipientList;
TIdMessage *obj_TIDMessage;
TIdAttachment *obj_TIDAttachment;
if(TIdSMTP1->Connected()) TIdSMTP1->Disconnect();
if(!TIdSMTP1->Connected())
{
TIdSMTP1->Host = "ici Mon SMTP";
TIdSMTP1->Port = 25;
TIdSMTP1->Username = "ici MonUserName";
TIdSMTP1->Password = "ici MonPassWord";
if((TIdSMTP1->Username.Trim().Length() == 0) && (TIdSMTP1->Password.Trim().Length() == 0))
{
TIdSMTP1->AuthenticationType = atNone;
}
else
{
TIdSMTP1->AuthenticationType = atLogin;
}
TIdSMTP1->Connect();
}
if(TIdSMTP1->Authenticate())
{
obj_TIDMessage = new TIdMessage(this);
obj_TIDMessage->From->Address = "ici MonEmail";
obj_TIDMessage->From->Name = "ici MonEmail";
obj_TIDMessage->ReplyTo->EMailAddresses = "ici MonEmail";
obj_TIDRecipientList = new TIdEMailAddressList(obj_TIDMessage->Recipients);
obj_TIDRecipientList->Add();
obj_TIDRecipientList->EMailAddresses = "EmailDestinataire";
obj_TIDMessage->Recipients = obj_TIDRecipientList;
obj_TIDMessage->Subject = "subject";
for(int i=0; i<10; i++)
{
obj_TIDMessage->Body->Add("Ligne " + String(i));
}
obj_TIDAttachment = new TIdAttachment(obj_TIDMessage->MessageParts, "c:\\test.txt");
obj_TIDAttachment->ContentType = "application/txt";
TIdSMTP1->Send(obj_TIDMessage);
obj_TIDMessage->Clear();
}
else
{
ShowMessage("Erreur d'authentification");
}
TIdSMTP1->Disconnect();
TIdSMTP1->Free();
obj_TIDMessage->Free(); |
Auriez-vous une idée d'ou provient cette erreur ?
Merci d'avance
Fred