E-mail import from Access using Delphi

Essay by rodentratman July 2004

download word file, 2 pages 3.3

Downloaded 31 times

As part of Project Management in a Certificate IV in IT, our project team was required to create a database that would simplify the work of one of the teachers at the senior college I was attending.

The database consisted of five tables being Students, Student Interests, Interests, Position Interests and Positions. The database was centered on carefully chosen interests. For clarity I will not go into any detail here.

Once the database had been completed, the teacher wished to have a sort of automatic contact available for positions that were available for students to apply for (again by interest).

A query was exported to a file containing the fields relevant to the position including the student name and the details of the position.

Delphi development arose when I needed to read the exported semi-colon-delimited text file and transfer it into a readable e-mail and automatically send each e-mail.

The main code for the Delphi program follows and is available to modify and use by other Delphi developers if they have a database of contacts that they wish to e-mail.

I also apologise for the non-standard naming of the components.

{ Mailer unit follows. }

unit mailer;

interface

uses

Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,

NMpop3, StdCtrls, Psock, NMsmtp, Mask, ComCtrls, Math, Menus, ExtCtrls, Registry;

type

TForm1 = class(TForm)

Mailer: TNMSMTP;

Memo1: TMemo;

ReplyToLbl: TLabel;

ReplyToEdit: TEdit;

StatusBar: TStatusBar;

BCCLbl: TLabel;

BCCText: TMemo;

OpenDialog: TOpenDialog;

MainMenu1: TMainMenu;

File1: TMenuItem;

OpenListForBCCAddresses1: TMenuItem;

Connect1: TMenuItem;

Account1: TMenuItem;

EditAccountDetails1: TMenuItem;

Bevel1: TBevel;

Panel1: TPanel;

Label3: TLabel;

MyListBox: TListBox;

procedure CheckerConnectionFailed(Sender: TObject);

procedure EditAccountDetails1Click(Sender: TObject);

procedure Connect1Click(Sender: TObject);

procedure OpenListForBCCAddresses1Click(Sender: TObject);

procedure AddStrings(S: String);

private

{ Private declarations }

public

{ Public declarations }

end;

var

Form1: TForm1;

i: Integer;

Count: Integer;

EAD: Boolean;

implementation

uses account;

{$R *.DFM}

procedure TForm1. CheckerConnectionFailed(Sender:...