Thread View: borland.public.cppbuilder.internet.socket
9 messages
9 total messages
Started by Van Wouwe Francois
Tue, 27 Mar 2007 10:21
problem using INDY component when sending email
Author: Van Wouwe Francois
Date: Tue, 27 Mar 2007 10:21
Date: Tue, 27 Mar 2007 10:21
73 lines
3386 bytes
3386 bytes
Hi,
When I use the SMTP component for sending email, the mail is send out, but
when I close the form
I get an access violation at a given address, during the read of that
address.
Herewith the code which I use
If someone can give me a hint of what the problem might be
private: // User declarations
String maillist;
void __fastcall TF_Deelnemers::Email1Click(TObject *Sender)
{
extern int RecId_club;
extern String WORKDIR,PROGDIR;
char buf[200];
int taal;
String temp,tornooi,tornooinaam,mailsettings;
maillist="";
maillist=DM->Q_CLUBS->FieldByName("email")->AsString;
TIdEMailAddressItem *MAILLIST = IdMessage1->Sender;
TIdEMailAddressList *TOLIST = new TIdEMailAddressList(this);
TIdEMailAddressList *BCCLIST = new TIdEMailAddressList(this);
...
mailsettings=String(buf);
MAILLIST->Name=mailsettings;
...
mailsettings=String(buf);
MAILLIST->Address=mailsettings;
TOLIST->EMailAddresses=maillist;
IdMessage1->Recipients=TOLIST;
IdMessage1->From=MAILLIST;
IdMessage1->Sender=MAILLIST;
maillist="francois.van.wouwe@skynet.be";
BCCLIST->EMailAddresses=maillist;
IdMessage1->BccList=BCCLIST;
...
IdMessage1->Subject="Confirmation of inscription "+tornooinaam;
IdMessage1->ContentType="text/plain";
IdMessage1->Body->Clear();
IdMessage1->Body->Add("Club =
"+DM->Q_CLUBS->FieldByName("nr")->AsString+"
"+DM->Q_CLUBS->FieldByName("naam")->AsString+"\n");
....
IdMessage1->Body->Add("\nWith sporty greetings\n");
...
mailsettings=String(buf);
IdMessage1->Body->Add(mailsettings);
GetPrivateProfileString("Email","SMTPHost","",buf,sizeof(buf),tornooi.c_str());
mailsettings=String(buf);
IdSMTP1->Host=mailsettings;
GetPrivateProfileString("Email","Username","",buf,sizeof(buf),tornooi.c_str());
mailsettings=String(buf);
IdSMTP1->Username=mailsettings;
if (!IdSMTP1->Connected())
{
IdSMTP1->Connect(-1);
}
IdSMTP1->Send(IdMessage1);
IdSMTP1->Disconnect();
delete TOLIST;
delete BCCLIST;
IdSMTP1->Destroying();
IdMessage1->Destroying();
ShowMessage("E-mail is verstuurd");
}
--
Kind regards
Francois Van Wouwe
Re: problem using INDY component when sending email
Author: Hans Galema
Date: Tue, 27 Mar 2007 10:44
Date: Tue, 27 Mar 2007 10:44
16 lines
1387 bytes
1387 bytes
Van Wouwe Francois wrote: > When I use the SMTP component for sending email, the mail is send out, Which Indy version do you use? Version of bcb? > but > when I close the form > I get an access violation at a given address, during the read of that > address. Please post a complete example. As small as possible. Whitout the use of the database. So we can compile and link to see what happens. Hans.
Re: problem using INDY component when sending email
Author: Van Wouwe Francois
Date: Tue, 27 Mar 2007 11:55
Date: Tue, 27 Mar 2007 11:55
79 lines
3155 bytes
3155 bytes
Hi,
think that this code should work
BCB = version 4
Indy = 9.0.4
private: // User declarations
String maillist;
void __fastcall TF_Deelnemers::Email1Click(TObject *Sender)
{
String temp,tornooi,tornooinaam,mailsettings;
maillist="";
tornooinaam="tornooi";
maillist="test@test";
TIdEMailAddressItem *MAILLIST = IdMessage1->Sender;
TIdEMailAddressList *TOLIST = new TIdEMailAddressList(this);
TIdEMailAddressList *BCCLIST = new TIdEMailAddressList(this);
mailsettings="email from";
MAILLIST->Name=mailsettings;
mailsettings="test@test";
MAILLIST->Address=mailsettings;
TOLIST->EMailAddresses=maillist;
IdMessage1->Recipients=TOLIST;
IdMessage1->From=MAILLIST;
IdMessage1->Sender=MAILLIST;
maillist="francois.van.wouwe@skynet.be";
BCCLIST->EMailAddresses=maillist;
IdMessage1->BccList=BCCLIST;
IdMessage1->Subject="Confirmation of inscription ";
IdMessage1->ContentType="text/plain";
IdMessage1->Body->Clear();
IdMessage1->Body->Add("\nWith sporty greetings\n");
mailsettings="relay.skynet.be";
IdSMTP1->Host=mailsettings;
mailsettings="sky83302";
IdSMTP1->Username=mailsettings;
if (!IdSMTP1->Connected())
{
IdSMTP1->Connect(-1);
}
IdSMTP1->Send(IdMessage1);
IdSMTP1->Disconnect();
delete TOLIST;
delete BCCLIST;
IdSMTP1->Destroying();
IdMessage1->Destroying();
ShowMessage("E-mail is verstuurd");
}
kind regards
Francois Van Wouwe
--
met vriendelijke groeten
Francois Van Wouwe
"Hans Galema" <notused@notused.nl> wrote in message
news:4608f66e@newsgroups.borland.com...
> Van Wouwe Francois wrote:
>
>> When I use the SMTP component for sending email, the mail is send out,
>
> Which Indy version do you use? Version of bcb?
>
>> but when I close the form
>> I get an access violation at a given address, during the read of that
>> address.
>
> Please post a complete example. As small as possible. Whitout
> the use of the database. So we can compile and link to see what
> happens.
>
> Hans.
Re: problem using INDY component when sending email
Author: Hans Galema
Date: Tue, 27 Mar 2007 15:03
Date: Tue, 27 Mar 2007 15:03
10 lines
1173 bytes
1173 bytes
Van Wouwe Francois wrote: > think that this code should work > > BCB = version 4 > Indy = 9.0.4 That does work here with Indy 9.0.50 and Turbo C++. Hans.
Re: problem using INDY component when sending email
Author: Remy Lebeau (TeamB)
Date: Tue, 27 Mar 2007 18:16
Date: Tue, 27 Mar 2007 18:16
66 lines
2787 bytes
2787 bytes
"Van Wouwe Francois" <francois.van.wouwe@skynet.be> wrote in message
news:4608f043$1@newsgroups.borland.com...
> When I use the SMTP component for sending email, the mail is send
> out, but when I close the form I get an access violation at a given
> address, during the read of that address.
That is because you are using it wrong. Why are you calling
Destroying() at all?
Use this code instead:
extern int RecId_club;
extern String WORKDIR, PROGDIR;
void __fastcall TF_Deelnemers::Email1Click(TObject *Sender)
{
char buf[200];
int taal;
String temp, tornooi, tornooinaam;
IdMessage1->Clear();
...
IdMessage1->Sender->Name = buf;
...
IdMessage1->Sender->Address = buf;
IdMessage1->Recipients->EMailAddresses =
DM->Q_CLUBS->FieldByName("email")->AsString;
IdMessage1->From->Assign(IdMessage1->Sender);
IdMessage1->BccList->EMailAddresses =
"francois.van.wouwe@skynet.be";
...
IdMessage1->Subject = "Confirmation of inscription " +
tornooinaam;
IdMessage1->ContentType = "text/plain";
IdMessage1->Body->Add("Club = " +
DM->Q_CLUBS->FieldByName("nr")->AsString + " " +
DM->Q_CLUBS->FieldByName("naam")->AsString);
....
IdMessage1->Body->Add("");
IdMessage1->Body->Add("With sporty greetings");
...
IdMessage1->Body->Add(buf);
GetPrivateProfileString("Email", "SMTPHost", "", buf,
sizeof(buf), tornooi.c_str());
IdSMTP1->Host = buf;
GetPrivateProfileString("Email", "Username", "", buf,
sizeof(buf), tornooi.c_str());
IdSMTP1->Username = buf;
IdSMTP1->Connect(5000);
try {
IdSMTP1->Send(IdMessage1);
}
__finally {
IdSMTP1->Disconnect();
}
ShowMessage("E-mail is verstuurd");
}
Gambit
Re: problem using INDY component when sending email
Author: Remy Lebeau (TeamB)
Date: Tue, 27 Mar 2007 18:17
Date: Tue, 27 Mar 2007 18:17
11 lines
1155 bytes
1155 bytes
"Van Wouwe Francois" <francois.van.wouwe@skynet.be> wrote in message news:4609061e$1@newsgroups.borland.com... > Indy = 9.0.4 That is a very old release of Indy 9. The current development snapshot for Indy 9 is 9.0.50. Gambit
Re: problem using INDY component when sending email
Author: Van Wouwe Francois
Date: Thu, 05 Apr 2007 08:30
Date: Thu, 05 Apr 2007 08:30
29 lines
1709 bytes
1709 bytes
Hi, When i look to the Indy website www.nevrona.com/indy, the alst version I see is 9.0.18 Where can I find 9.0.50 ??? When installing, can I just delete the old dirs and replace with the new one ? -- met vriendelijke groeten Francois Van Wouwe "Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message news:460951fc$1@newsgroups.borland.com... > > "Van Wouwe Francois" <francois.van.wouwe@skynet.be> wrote in message > news:4609061e$1@newsgroups.borland.com... > >> Indy = 9.0.4 > > That is a very old release of Indy 9. The current development > snapshot for Indy 9 is 9.0.50. > > > Gambit > >
Re: problem using INDY component when sending email
Author: Remy Lebeau (TeamB)
Date: Thu, 05 Apr 2007 16:33
Date: Thu, 05 Apr 2007 16:33
22 lines
1657 bytes
1657 bytes
"Van Wouwe Francois" <francois.van.wouwe@skynet.be> wrote in message news:4614b3b7@newsgroups.borland.com... > When i look to the Indy website www.nevrona.com/indy That is not the URL of the official Indy website. The official URL is http://www.indyproject.org. > the alst version I see is 9.0.18 > Where can I find 9.0.50 ??? As I told you earlier, 9.0.50 is the Development Snapshot. There are links to it. > When installing, can I just delete the old dirs and replace > with the new one ? Please read the Knowledge Base. Gambit
Re: problem using INDY component when sending email
Author: Van Wouwe Francois
Date: Fri, 06 Apr 2007 15:51
Date: Fri, 06 Apr 2007 15:51
34 lines
1938 bytes
1938 bytes
Thanks Remy, I found the version 9.0.50 and now it works perfect. kind regards Francois Van Wouwe "Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message news:46152681$1@newsgroups.borland.com... > > "Van Wouwe Francois" <francois.van.wouwe@skynet.be> wrote in message > news:4614b3b7@newsgroups.borland.com... > >> When i look to the Indy website www.nevrona.com/indy > > That is not the URL of the official Indy website. The official URL is > http://www.indyproject.org. > >> the alst version I see is 9.0.18 >> Where can I find 9.0.50 ??? > > As I told you earlier, 9.0.50 is the Development Snapshot. There are > links to it. > >> When installing, can I just delete the old dirs and replace >> with the new one ? > > Please read the Knowledge Base. > > > Gambit > >
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads