Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Internet
Registrarse FAQ Miembros Calendario Guía de estilo Buscar Temas de Hoy Marcar Foros Como Leídos

Colaboración Paypal con ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #4  
Antiguo 19-07-2008
Avatar de white_zombie
[white_zombie] white_zombie is offline
Miembro Premium
 
Registrado: nov 2005
Ubicación: Zaragoza - España
Posts: 187
Poder: 21
white_zombie Va por buen camino
Hola, una vez hice la prueba de enviar correos con html y me funciono, este es código:

Código Delphi [-]
var
  html: TStrings;
  partehtml: TIdText;
  partettxt:TIdText;
  partejpg: TIdAttachment;
  email: TIdMessage;
  filename: string;
begin
  filename := ExtractFilePath(Application.ExeName) + 'logo.jpg';

  html := TStringList.Create();
  html.Add('');
  html.Add('');
  html.Add('');
  html.Add('

Prueba

'
); html.Add(''); html.Add('Ahi va la FOTO!'); html.Add(''); email := TIdMessage.Create(nil); email.From.Text := '[email protected]'; email.Recipients.EMailAddresses := '[email protected]'; email.Subject := 'PRUEBA html'; email.ContentType := 'multipart/mixed'; email.Body.Assign(html); partettxt := TIdText.Create(email.MessageParts); partettxt.ContentType := 'text/plain'; partettxt.Body.Text := ''; partehtml := TIdText.Create(email.MessageParts, html); partehtml.ContentType := 'text/html'; partejpg := TIdAttachment.Create(email.MessageParts, filename); partejpg.ContentType := 'image/jpeg'; partejpg.FileIsTempFile := true; partejpg.ContentDisposition := 'inline'; partejpg.ExtraHeaders.Values['content-id'] := 'logo.jpg'; partejpg.DisplayName := 'logo.jpg'; with IdSMTP do begin // Configuro autentificación. AuthenticationType := atLogin; Username := 'Username'; // Nombre del usuario Password := 'Password'; // la password // Configuro el servidor SMTP. Host := 'Host'; Port := 25; try Connect; try // Envio el mensaje. Send(email); finally Disconnect; end; showMessage('Enviado Correctamente'); except // Capturo algunas excepciones que pueden ocurrir ON E: EIdProtocolReplyError do begin showmessage('No se ha podido enviar el email.' + #13 + 'Incorrecto el email o el usuario o la password.'); end; on E: EFOpenError do begin showMessage('No se ha podido enviar el email.' + #13 + 'Fichero Adjunto desconocido o erróneo.'); end; on E: EIdSocketError do begin showmessage('No se ha podido enviar el email.'+ #13 + 'Host desconocido o incorrecto.'); end; else begin showMessage('Fallo en el envio de email'); raise; end; end; if connected then IdSMTP.Disconnect; end; end;

Espero que te sirva de ayuda.

Un Saludo.
Responder Con Cita
 


Herramientas Buscar en Tema
Buscar en Tema:

Búsqueda Avanzada
Desplegado

Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Enviar un correo electronico desde delphi 7 carlos gonzalez Varios 3 07-06-2008 18:04:29
Enviar correo electrónico desde delphi luisneria Internet 3 02-03-2007 18:07:27
ENVIAR CORREO mi cuenta de correo es GMAIL ASAPLTDA PHP 1 16-11-2006 00:54:03
Problemas al Enviar Correo con Ciertas Dir. de Correo AGAG4 Internet 2 01-02-2006 20:37:42
Ayuda con Delphi 4 para enviar correo Nasio Internet 6 19-05-2004 08:00:20


La franja horaria es GMT +2. Ahora son las 10:42:23.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi