Article View: borland.public.cppbuilder.internet.socket
Article #495Re: Need help on email from BCB
From: Joe Pasquariello
Date: Wed, 05 Mar 2008 18:33
Date: Wed, 05 Mar 2008 18:33
60 lines
3277 bytes
3277 bytes
Derek, The simplest way to send email with Indy is to use function IdSMTP::QuickSend(). The code below is from a little test program I wrote for CB2007. No need to put an Indy objects on your form. I just put some TEdit objects to allow entering the various fields for QuickSend(), use the #include as shown below, and call the function. If you need attachments or additional features, you'll have to get into Indy in more detail. FYI, the version of Indy that is installed with CB2007 is fairly old. You will see many recommendations on this group to update to the newest snapshot, but there's no documented procedure, so it's not very easy to do. If you are doing very simple stuff, like this, you may be able to limp along with this version, otherwise you'll have to try to piece together an update procedure from messages on this group. According to David of Codegear, the next release of CB will include an up-to-date and relatively bug-free version of Indy. Joe #include <IdSMTP.hpp> // IdSMTP::QuickSend() AnsiString Host = HostEdit->Text; AnsiString Subject = SubjectEdit->Text; AnsiString To = ToEdit->Text; AnsiString From = FromEdit->Text; AnsiString Body = BodyMemo->Text; // Note that some (static?) INDY functions require an additional (first) // argument as used below when called from C++Builder. Note also that // QuickSend() function does not require a pre-existing TIdSMTP object. TIdSMTP::QuickSend( __classid(TIdSMTP), Host, Subject, To, From, Body ); Derek Harvey wrote: > Hi Folks, > I want to add a simple emailer to my program but am finding it hard to find > a way into the facilities BCB2007 might offer towards this aim, e.g., what > components do I use and how. This is so important these days that I am > surprised there are no samples of such things provided with the project. > Later I will want FTP. > > In the Help there is a vast collection of items for TIdSMTP, etc. but no > easy way into this morass of information. > > Does anyone know of a sample program I can build on? > > In BCB6 there were some components in a group FastNet which seemed quite > easy to use but I don't find them in BCB2007. What would happen if I moved a > small FTP program I wrote as an experiment into 2007? Well, I could try, I > suppose. > > Anby help welcomed. > TIA > Derek > >
Technical Details
Message-ID:
<47cee75d$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<47cea1cb$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,a96ad1efe07bc68c X-Google-Attributes: gid11508e,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Date: Wed, 05 Mar 2008 10:33:20 -0800 From: Joe Pasquariello <joep@fenway.com> User-Agent: Thunderbird 2.0.0.12 (Windows/20080213) MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.internet.socket Subject: Re: Need help on email from BCB References: <47cea1cb$1@newsgroups.borland.com> In-Reply-To: <47cea1cb$1@newsgroups.borland.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 76.191.143.61 Message-ID: <47cee75d$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1204741981 76.191.143.61 (5 Mar 2008 10:33:01 -0700) Lines: 60 Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail