 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Van Wouwe Francois Guest
|
Posted: Tue Mar 27, 2007 3:21 pm Post subject: problem using INDY component when sending email |
|
|
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 (AT) skynet (DOT) 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 |
|
| Back to top |
|
 |
Hans Galema Guest
|
Posted: Tue Mar 27, 2007 3:44 pm Post subject: Re: problem using INDY component when sending email |
|
|
Van Wouwe Francois wrote:
| Quote: | When I use the SMTP component for sending email, the mail is send out,
|
Which Indy version do you use? Version of bcb?
| Quote: | 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. |
|
| Back to top |
|
 |
Van Wouwe Francois Guest
|
Posted: Tue Mar 27, 2007 4:55 pm Post subject: Re: problem using INDY component when sending email |
|
|
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 (AT) skynet (DOT) 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 (AT) notused (DOT) nl> wrote in message
news:4608f66e (AT) newsgroups (DOT) borland.com...
| Quote: | 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. |
|
|
| Back to top |
|
 |
Hans Galema Guest
|
Posted: Tue Mar 27, 2007 8:03 pm Post subject: Re: problem using INDY component when sending email |
|
|
Van Wouwe Francois wrote:
| Quote: | 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. |
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Tue Mar 27, 2007 11:16 pm Post subject: Re: problem using INDY component when sending email |
|
|
"Van Wouwe Francois" <francois.van.wouwe (AT) skynet (DOT) be> wrote in message
news:4608f043$1 (AT) newsgroups (DOT) borland.com...
| Quote: | 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 (AT) skynet (DOT) 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 |
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Tue Mar 27, 2007 11:17 pm Post subject: Re: problem using INDY component when sending email |
|
|
"Van Wouwe Francois" <francois.van.wouwe (AT) skynet (DOT) be> wrote in message
news:4609061e$1 (AT) newsgroups (DOT) borland.com...
That is a very old release of Indy 9. The current development
snapshot for Indy 9 is 9.0.50.
Gambit |
|
| Back to top |
|
 |
Van Wouwe Francois Guest
|
Posted: Thu Apr 05, 2007 1:30 pm Post subject: Re: problem using INDY component when sending email |
|
|
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 (AT) no (DOT) spam.com> wrote in message
news:460951fc$1 (AT) newsgroups (DOT) borland.com...
| Quote: |
"Van Wouwe Francois" <francois.van.wouwe (AT) skynet (DOT) be> wrote in message
news:4609061e$1 (AT) newsgroups (DOT) 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
|
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Thu Apr 05, 2007 9:33 pm Post subject: Re: problem using INDY component when sending email |
|
|
"Van Wouwe Francois" <francois.van.wouwe (AT) skynet (DOT) be> wrote in message
news:4614b3b7 (AT) newsgroups (DOT) borland.com...
That is not the URL of the official Indy website. The official URL is
http://www.indyproject.org.
| Quote: | 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.
| Quote: | When installing, can I just delete the old dirs and replace
with the new one ?
|
Please read the Knowledge Base.
Gambit |
|
| Back to top |
|
 |
Van Wouwe Francois Guest
|
Posted: Fri Apr 06, 2007 8:51 pm Post subject: Re: problem using INDY component when sending email |
|
|
Thanks Remy,
I found the version 9.0.50 and now it works perfect.
kind regards
Francois Van Wouwe
"Remy Lebeau (TeamB)" <no.spam (AT) no (DOT) spam.com> wrote in message
news:46152681$1 (AT) newsgroups (DOT) borland.com...
| Quote: |
"Van Wouwe Francois" <francois.van.wouwe (AT) skynet (DOT) be> wrote in message
news:4614b3b7 (AT) newsgroups (DOT) 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
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|