用 Indy 套件吧,fastNet 毛病多多。
解决方案 »
- 如何用delphi对自己的文件进行rar或者winzip压缩,然后再读取出来?
- 不允许从数据类型money到varchar的隐性转换,请使用convert函数来运行此查询
- 请问怎么实现在不同的分辨率下,打开的窗口界面一样大
- 一个关于查询的问题,在线等待,
- 怎样实现字符替换?解决后马上给分!
- 关于在WebSnap三层系统中更新资料
- 如何控制DBGrid的列不允许使用鼠标拖动而改变列的顺序?
- 求教:如何在delphi 5 中使用HTML Help(.CHM)
- 请问在DELPHI下怎么比较两个文件是否一样?
- 如何作出象OICQ那样的彩色POPUPMENU?参与有分
- 怎么隐藏RichEdit中的那个闪啊闪的插入光标?
- 怎么获得一个数据库中所有表的名字?立即给分
unit SimpleMails;interfaceuses
Windows, Messages, SysUtils, Classes, Winsock, Psock;type
TSimpleSMTP = class(TPowerSock)
private
FBody: string;
FPassword: string;
FSubject: string;
FUsername: string;
FMailFrom: string;
FMailTo: string;
procedure SetBody(const Value: string);
procedure SetMailFrom(const Value: string);
procedure SetMailTo(const Value: string);
procedure SetPassword(const Value: string);
procedure SetSubject(const Value: string);
procedure SetUsername(const Value: string);
procedure RaiseError(const Msg: string);
published
property MailTo: string read FMailTo write SetMailTo;
property MailFrom: string read FMailFrom write SetMailFrom;
property Subject: string read FSubject write SetSubject;
property Body: string read FBody write SetBody;
property Username: string read FUsername write SetUsername;
property Password: string read FPassword write SetPassword; public
function Transaction(const CommandString: String): String; override;
public
function SendMail: Boolean;
constructor Create(AOwner: TComponent); override;
end; function EncodeBase64(Source: string): string; procedure Register;implementationconst
BaseTable = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';function EncodeBase64(Source:string):string;
var
Times, LenSrc, i: Integer;
x1, x2, x3, x4: Char;
xt: Byte;
begin
Result := '';
LenSrc := Length(Source);
if LenSrc mod 3 = 0 then
Times := LenSrc div 3
else
Times := LenSrc div 3 + 1;
for i := 0 to Times - 1 do
begin
if LenSrc >= (3 + i * 3) then
begin
x1 := BaseTable[(ord(Source[1 + i * 3]) shr 2)+1];
xt := (ord(Source[1 + i * 3]) shl 4) and 48;
xt := xt or (ord(Source[2 + i * 3]) shr 4);
x2 := BaseTable[xt + 1];
xt := (Ord(Source[2 + i * 3]) shl 2) and 60;
xt := xt or (Ord(Source[3 + i * 3]) shr 6);
x3 := BaseTable[xt + 1];
xt := (ord(Source[3 + i * 3]) and 63);
x4 := BaseTable[xt + 1];
end
else if LenSrc >= (2 + i * 3) then
begin
x1 := BaseTable[(Ord(Source[1 + i * 3]) shr 2) + 1];
xt := (Ord(Source[1 + i * 3]) shl 4) and 48;
xt := xt or (Ord(Source[2 + i * 3]) shr 4);
x2 := BaseTable[xt + 1];
xt := (Ord(Source[2 + i * 3]) shl 2) and 60;
x3 := BaseTable[xt + 1];
x4 := '=';
end else
begin
x1 := BaseTable[(Ord(Source[1 + i * 3]) shr 2)+1];
xt := (Ord(Source[1 + i * 3]) shl 4) and 48;
x2 := BaseTable[xt + 1];
x3 := '=';
x4 := '=';
end;
Result := Result + x1 + x2 + x3 + x4;
end;
end;
// this function by Matjaz Bravc
function sak_GetInternetDate( const Date: TDateTime):string;
(* The date in RFC 822 conform string format *) function int2str(value:integer; len:byte):string;
begin
result := IntToStr( value);
while length( result) < len do result := '0' + result;
end; function GetTimeZoneBias:longint;
(* The offset to UTC/GMT in minutes of the local time zone *)
var tz_info: TTimeZoneInformation;
begin
case GetTimeZoneInformation(tz_info) of
1: result := tz_info.StandardBias+tz_info.Bias;
2: result := tz_info.DaylightBias+tz_info.Bias;
else
result := tz_info.DaylightBias+tz_info.Bias;
end;
end; function GetTimeZone:string;
var bias: longint;
begin
bias := GetTimeZoneBias;
if bias = 0 then
begin
result := 'GMT';
end else
begin
if bias < 0 then
begin
result := '+' + int2str(abs(bias) div 60,2)+int2str(abs(bias) mod 60,2);
end else
begin
if bias > 0 then
begin
result := '-' + int2str(bias div 60,2)+int2str(bias mod 60,2);
end;
end;
end;
end;var
d, m, y, w, h, mm, s, ms: word;
const
WeekDays: array [1..7] of string[3] = ('Sun','Mon','Tue','Wed',
'Thu','Fri','Sat');
Months: array [1..12] of string[3] = ('Jan','Feb','Mar','Apr','May','Jun',
'Jul','Aug','Sep','Oct','Nov','Dec');
begin
DecodeDate( date, y, m, d);
DecodeTime( date, h, mm, s, ms);
w := DayOfWeek( date);
Result := weekdays[w] + ', ' +
inttostr(d) + ' ' +
months[m] + ' ' +
inttostr(y) + ' ' +
int2str(h,2) + ':' +
int2str(mm,2) + ':' +
int2str(s,2) + ' ' +
GetTimeZone;
end;function GetComputerName: string;
var
n: Cardinal;
begin
n:= MAX_COMPUTERNAME_LENGTH + 1;
SetLength(Result, n);
Windows.GetComputerName(PChar(Result), n);
SetLength(Result, n);
end;
unit SimpleMails;interfaceuses
Windows, Messages, SysUtils, Classes, Winsock, Psock;type
TSimpleSMTP = class(TPowerSock)
private
FBody: string;
FPassword: string;
FSubject: string;
FUsername: string;
FMailFrom: string;
FMailTo: string;
procedure SetBody(const Value: string);
procedure SetMailFrom(const Value: string);
procedure SetMailTo(const Value: string);
procedure SetPassword(const Value: string);
procedure SetSubject(const Value: string);
procedure SetUsername(const Value: string);
procedure RaiseError(const Msg: string);
published
property MailTo: string read FMailTo write SetMailTo;
property MailFrom: string read FMailFrom write SetMailFrom;
property Subject: string read FSubject write SetSubject;
property Body: string read FBody write SetBody;
property Username: string read FUsername write SetUsername;
property Password: string read FPassword write SetPassword; public
function Transaction(const CommandString: String): String; override;
public
function SendMail: Boolean;
constructor Create(AOwner: TComponent); override;
end; function EncodeBase64(Source: string): string; procedure Register;implementationconst
BaseTable = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';function EncodeBase64(Source:string):string;
var
Times, LenSrc, i: Integer;
x1, x2, x3, x4: Char;
xt: Byte;
begin
Result := '';
LenSrc := Length(Source);
if LenSrc mod 3 = 0 then
Times := LenSrc div 3
else
Times := LenSrc div 3 + 1;
for i := 0 to Times - 1 do
begin
if LenSrc >= (3 + i * 3) then
begin
x1 := BaseTable[(ord(Source[1 + i * 3]) shr 2)+1];
xt := (ord(Source[1 + i * 3]) shl 4) and 48;
xt := xt or (ord(Source[2 + i * 3]) shr 4);
x2 := BaseTable[xt + 1];
xt := (Ord(Source[2 + i * 3]) shl 2) and 60;
xt := xt or (Ord(Source[3 + i * 3]) shr 6);
x3 := BaseTable[xt + 1];
xt := (ord(Source[3 + i * 3]) and 63);
x4 := BaseTable[xt + 1];
end
else if LenSrc >= (2 + i * 3) then
begin
x1 := BaseTable[(Ord(Source[1 + i * 3]) shr 2) + 1];
xt := (Ord(Source[1 + i * 3]) shl 4) and 48;
xt := xt or (Ord(Source[2 + i * 3]) shr 4);
x2 := BaseTable[xt + 1];
xt := (Ord(Source[2 + i * 3]) shl 2) and 60;
x3 := BaseTable[xt + 1];
x4 := '=';
end else
begin
x1 := BaseTable[(Ord(Source[1 + i * 3]) shr 2)+1];
xt := (Ord(Source[1 + i * 3]) shl 4) and 48;
x2 := BaseTable[xt + 1];
x3 := '=';
x4 := '=';
end;
Result := Result + x1 + x2 + x3 + x4;
end;
end;
// this function by Matjaz Bravc
function sak_GetInternetDate( const Date: TDateTime):string;
(* The date in RFC 822 conform string format *) function int2str(value:integer; len:byte):string;
begin
result := IntToStr( value);
while length( result) < len do result := '0' + result;
end; function GetTimeZoneBias:longint;
(* The offset to UTC/GMT in minutes of the local time zone *)
var tz_info: TTimeZoneInformation;
begin
case GetTimeZoneInformation(tz_info) of
1: result := tz_info.StandardBias+tz_info.Bias;
2: result := tz_info.DaylightBias+tz_info.Bias;
else
result := tz_info.DaylightBias+tz_info.Bias;
end;
end; function GetTimeZone:string;
var bias: longint;
begin
bias := GetTimeZoneBias;
if bias = 0 then
begin
result := 'GMT';
end else
begin
if bias < 0 then
begin
result := '+' + int2str(abs(bias) div 60,2)+int2str(abs(bias) mod 60,2);
end else
begin
if bias > 0 then
begin
result := '-' + int2str(bias div 60,2)+int2str(bias mod 60,2);
end;
end;
end;
end;var
d, m, y, w, h, mm, s, ms: word;
const
WeekDays: array [1..7] of string[3] = ('Sun','Mon','Tue','Wed',
'Thu','Fri','Sat');
Months: array [1..12] of string[3] = ('Jan','Feb','Mar','Apr','May','Jun',
'Jul','Aug','Sep','Oct','Nov','Dec');
begin
DecodeDate( date, y, m, d);
DecodeTime( date, h, mm, s, ms);
w := DayOfWeek( date);
Result := weekdays[w] + ', ' +
inttostr(d) + ' ' +
months[m] + ' ' +
inttostr(y) + ' ' +
int2str(h,2) + ':' +
int2str(mm,2) + ':' +
int2str(s,2) + ' ' +
GetTimeZone;
end;function GetComputerName: string;
var
n: Cardinal;
begin
n:= MAX_COMPUTERNAME_LENGTH + 1;
SetLength(Result, n);
Windows.GetComputerName(PChar(Result), n);
SetLength(Result, n);
end;
unit SimpleMails;interfaceuses
Windows, Messages, SysUtils, Classes, Winsock, Psock;type
TSimpleSMTP = class(TPowerSock)
private
FBody: string;
FPassword: string;
FSubject: string;
FUsername: string;
FMailFrom: string;
FMailTo: string;
procedure SetBody(const Value: string);
procedure SetMailFrom(const Value: string);
procedure SetMailTo(const Value: string);
procedure SetPassword(const Value: string);
procedure SetSubject(const Value: string);
procedure SetUsername(const Value: string);
procedure RaiseError(const Msg: string);
published
property MailTo: string read FMailTo write SetMailTo;
property MailFrom: string read FMailFrom write SetMailFrom;
property Subject: string read FSubject write SetSubject;
property Body: string read FBody write SetBody;
property Username: string read FUsername write SetUsername;
property Password: string read FPassword write SetPassword; public
function Transaction(const CommandString: String): String; override;
public
function SendMail: Boolean;
constructor Create(AOwner: TComponent); override;
end; function EncodeBase64(Source: string): string; procedure Register;implementationconst
BaseTable = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';function EncodeBase64(Source:string):string;
var
Times, LenSrc, i: Integer;
x1, x2, x3, x4: Char;
xt: Byte;
begin
Result := '';
LenSrc := Length(Source);
if LenSrc mod 3 = 0 then
Times := LenSrc div 3
else
Times := LenSrc div 3 + 1;
for i := 0 to Times - 1 do
begin
if LenSrc >= (3 + i * 3) then
begin
x1 := BaseTable[(ord(Source[1 + i * 3]) shr 2)+1];
xt := (ord(Source[1 + i * 3]) shl 4) and 48;
xt := xt or (ord(Source[2 + i * 3]) shr 4);
x2 := BaseTable[xt + 1];
xt := (Ord(Source[2 + i * 3]) shl 2) and 60;
xt := xt or (Ord(Source[3 + i * 3]) shr 6);
x3 := BaseTable[xt + 1];
xt := (ord(Source[3 + i * 3]) and 63);
x4 := BaseTable[xt + 1];
end
else if LenSrc >= (2 + i * 3) then
begin
x1 := BaseTable[(Ord(Source[1 + i * 3]) shr 2) + 1];
xt := (Ord(Source[1 + i * 3]) shl 4) and 48;
xt := xt or (Ord(Source[2 + i * 3]) shr 4);
x2 := BaseTable[xt + 1];
xt := (Ord(Source[2 + i * 3]) shl 2) and 60;
x3 := BaseTable[xt + 1];
x4 := '=';
end else
begin
x1 := BaseTable[(Ord(Source[1 + i * 3]) shr 2)+1];
xt := (Ord(Source[1 + i * 3]) shl 4) and 48;
x2 := BaseTable[xt + 1];
x3 := '=';
x4 := '=';
end;
Result := Result + x1 + x2 + x3 + x4;
end;
end;
// this function by Matjaz Bravc
function sak_GetInternetDate( const Date: TDateTime):string;
(* The date in RFC 822 conform string format *) function int2str(value:integer; len:byte):string;
begin
result := IntToStr( value);
while length( result) < len do result := '0' + result;
end; function GetTimeZoneBias:longint;
(* The offset to UTC/GMT in minutes of the local time zone *)
var tz_info: TTimeZoneInformation;
begin
case GetTimeZoneInformation(tz_info) of
1: result := tz_info.StandardBias+tz_info.Bias;
2: result := tz_info.DaylightBias+tz_info.Bias;
else
result := tz_info.DaylightBias+tz_info.Bias;
end;
end; function GetTimeZone:string;
var bias: longint;
begin
bias := GetTimeZoneBias;
if bias = 0 then
begin
result := 'GMT';
end else
begin
if bias < 0 then
begin
result := '+' + int2str(abs(bias) div 60,2)+int2str(abs(bias) mod 60,2);
end else
begin
if bias > 0 then
begin
result := '-' + int2str(bias div 60,2)+int2str(bias mod 60,2);
end;
end;
end;
end;var
d, m, y, w, h, mm, s, ms: word;
const
WeekDays: array [1..7] of string[3] = ('Sun','Mon','Tue','Wed',
'Thu','Fri','Sat');
Months: array [1..12] of string[3] = ('Jan','Feb','Mar','Apr','May','Jun',
'Jul','Aug','Sep','Oct','Nov','Dec');
begin
DecodeDate( date, y, m, d);
DecodeTime( date, h, mm, s, ms);
w := DayOfWeek( date);
Result := weekdays[w] + ', ' +
inttostr(d) + ' ' +
months[m] + ' ' +
inttostr(y) + ' ' +
int2str(h,2) + ':' +
int2str(mm,2) + ':' +
int2str(s,2) + ' ' +
GetTimeZone;
end;function GetComputerName: string;
var
n: Cardinal;
begin
n:= MAX_COMPUTERNAME_LENGTH + 1;
SetLength(Result, n);
Windows.GetComputerName(PChar(Result), n);
SetLength(Result, n);
end;