Thread View: borland.public.cppbuilder.internet.socket
3 messages
3 total messages
Started by Ricky
Wed, 08 Jun 2005 21:15
NMSMTP control in CBuilder5
Author: Ricky
Date: Wed, 08 Jun 2005 21:15
Date: Wed, 08 Jun 2005 21:15
34 lines
1969 bytes
1969 bytes
Hello,
I am using CBuilder5 and trying to get the sample program "smtpdemo" to
work. I can get the control to send and receive mail as long as the email
address is a valid address. The problem is that I want to be able to
validate the email address before I email but the Verify() doesn't seem to
work. Here is a snippet of the sample program that always returns false.
//---------------------------------------------------------------------------
void __fastcall TFormMain::Button3Click(TObject *Sender)
{
NMSMTP1->Host = "????.?????????.???"; // was Edit1->Text;
NMSMTP1->Port = 25; // was StrToInt(Edit2->Text);
NMSMTP1->UserID = "??????????????"; // Edit4->Text;
if (NMSMTP1->Connected)
NMSMTP1->Disconnect();
NMSMTP1->Connect();
if (NMSMTP1->Verify(Edit3->Text))
ShowMessage(Edit3->Text+" exists");
else
ShowMessage(Edit3->Text+" not verified");
}
Button3Click takes the value from Edit3->Text with is an email address to
check !
Thanks in advance for any help,
Rick
Re: NMSMTP control in CBuilder5
Author: Remy Lebeau (TeamB)
Date: Wed, 08 Jun 2005 22:08
Date: Wed, 08 Jun 2005 22:08
28 lines
2101 bytes
2101 bytes
"Ricky" <ricky_austin@bellsouth.net> wrote in message
news:42a75feb$1@newsgroups.borland.com...
> NMSMTP1->Host = "????.?????????.???"; // was Edit1->Text;
You cannot pass a full email address to Verify(), it only accepts a
username, so you have to connect directly to the SMTP server that the email
address belongs to. If the email address does not belong to the same domain
as your own SMTP server, then you will have to strip off the domain portion
of the email address, then perform an DNS lookup to get the MX record for
the domain, and then finally use the returned address as the Host. So, for
example, if you want to verify 'joe@smoe.com', you have to do an MX lookup
for the 'smoe.com' domain, the connect to the returned address, and then
finally call Verify('joe').
Do note, however, that many servers do not actually implement the VRFY
command (which the command that Verify() sends). In this case, you will not
be able to verify the address at all before sending it. You will just have
to proceed with sending the message and catch any rejection errors that may
occur.
> NMSMTP1->UserID = "??????????????"; // Edit4->Text;
UserID is not used with Verify()
Gambit
Re: NMSMTP control in CBuilder5
Author: Ricky
Date: Thu, 09 Jun 2005 00:47
Date: Thu, 09 Jun 2005 00:47
42 lines
2296 bytes
2296 bytes
It sounds like the best thing to do is just trap any errors and continue.
Thanks for your time and info.
Rick
"Ricky" <ricky_austin@bellsouth.net> wrote in message
news:42a75feb$1@newsgroups.borland.com...
> Hello,
>
> I am using CBuilder5 and trying to get the sample program "smtpdemo" to
> work. I can get the control to send and receive mail as long as the email
> address is a valid address. The problem is that I want to be able to
> validate the email address before I email but the Verify() doesn't seem to
> work. Here is a snippet of the sample program that always returns false.
>
>
> //---------------------------------------------------------------------------
> void __fastcall TFormMain::Button3Click(TObject *Sender)
> {
> NMSMTP1->Host = "????.?????????.???"; // was Edit1->Text;
> NMSMTP1->Port = 25; // was StrToInt(Edit2->Text);
> NMSMTP1->UserID = "??????????????"; // Edit4->Text;
>
> if (NMSMTP1->Connected)
> NMSMTP1->Disconnect();
>
> NMSMTP1->Connect();
>
> if (NMSMTP1->Verify(Edit3->Text))
> ShowMessage(Edit3->Text+" exists");
> else
> ShowMessage(Edit3->Text+" not verified");
>
> }
>
> Button3Click takes the value from Edit3->Text with is an email address to
> check !
>
>
> Thanks in advance for any help,
> Rick
>
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