FTP | CCD | Buscar | Trucos | Trabajo | Foros |
|
Registrarse | FAQ | Miembros | Calendario | Guía de estilo | Temas de Hoy |
|
Herramientas | Buscar en Tema | Desplegado |
|
#1
|
||||
|
||||
__________________
Guía de Estilo. |
#2
|
|||
|
|||
Yo acabo de hacer un programa que se limita a averiguar la direccion IP publica leyendo una pagina web 'www.showmyip.com/es' que en el titulo te devuelve tu direccion ip publica y enviarla por correo a una direccion. solo tienes que poner un componente idsmtp y otro idmenssaje de la pestaña indy.
Si quieres puedes guardar esta direccion y comprobar cada 10 minutos si ha cambiado en cuyo caso mandas otro correo. A mi me funciona. Juan p.d. la funcion para leer un trozo de html no la he hecho yo, esta tal y como la encontre. function LeerUnTrozoDeDocumentoHtmDesdeInternet( sUrl: string): string; type tbuffer = array[0..100] of char; // Aqui es donde puedes poner mas grande el buffer pbuffer = ^TBuffer; var buffer : pbuffer; a : cardinal; ihConnect, ihSession, iDocument : HINTERNET; begin Result:='NadaDeNada'; // Observa que Length(Result)=10 ihConnect:=InternetOpen('dChat/2.0 (JulianWEB)', LOCAL_INTERNET_ACCESS, '', '', 0); iDocument:=InternetOpenURL(ihConnect, pChar(sUrl), NIL, 1, INTERNET_FLAG_RELOAD or INTERNET_FLAG_DONT_CACHE or INTERNET_FLAG_RAW_DATA, 0); if iDocument<>nil then try New(buffer); InternetReadFile(iDocument, Buffer, sizeof(TBuffer), a); Result:=pchar(buffer); finally internetCloseHandle(iDocument); Dispose(buffer); InternetCloseHandle(ihConnect); end; end; procedure TForm1.FormShow(Sender: TObject); begin with mensaje do begin Body.Clear; Body.Add('Acaba de encender el ordenador'); Body.Add(copy(LeerUnTrozoDeDocumentoHtmDesdeInternet 'http://www.showmyip.com/es/'),59,15)); From.Text :='xxx@xxx.com'; Recipients.EMailAddresses := 'yyy@yyy.com'; Subject := 'Dirección IP xxx'; Priority := TidMessagePriority(mpHighest); end; with idSMTP1 do begin AuthenticationType := atLogin; Userid := 'xxx'; // Nombre del usuario Password := 'xxx'; // la password // Configuro el servidor SMTP. Host := 'smtp.xxx.com'; Port := 25; Connect; Send(mensaje); // Envio el mensaje. Disconnect; end; } end; |
|
|
|