Witam,
Ostatnio próbuję poznać obsługę smtp w c++ builderze. Jednak mam problem. Według moich spostrzeżeń programik łączy się z serwerem jednak nie wysyła wiadomości, a po chwili wyskakuje socket error. Jakby ktos nie miał co robic wrzucam kod :D
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
IdMessage1->Clear();
IdSMTP1->Host = "smtp.wp.pl" ;
IdSMTP1->UserId = "[email protected]";
IdSMTP1->Password = "xxxxxxx";
IdSMTP1->Port = 465;
IdSMTP1->AuthenticationType = atLogin;
IdMessage1->From->Text = "abc";
IdMessage1->Recipients->EMailAddresses= "[email protected]";
//IdMessage1->ReceiptRecipient ="[email protected]";
IdSMTP1->Connect();
IdSMTP1->Send(IdMessage1);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::IdSMTP1Connected(TObject *Sender)
{
ShowMessage("sukces");
}
//---------------------------------------------------------------------------