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

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 08-11-2007
Nayla Nayla is offline
Registrado
 
Registrado: nov 2007
Posts: 9
Poder: 0
Nayla Va por buen camino
Pues no se lo que hago mal pero sigue sin funcionar

Pongo un poco del codigo a ver si alguien me puede iluminar




Código Delphi [-]
 
with IdMessage do begin
ContentType := 'multipart/mixed';
From.Address := 'midireccion';
From.Name := vRemitent
Subject := 'MiAsunto'
Recipients.EMailAddresses := vMail;
Body.Clear;
end;
vNomArxiu := 'nombreImagen.jpg';
slBody := TStringList.Create;
slBody.Assign(ConstruirCosMissatge(pIdClient, pDataPublic, Usuari)); 
 
vIdText := TidText.Create(idMessage.MessageParts, slBody);
vIdText.ContentType := 'text/html';
 
if FileExists(vPathTemp + vNomArxiu) then begin
vIdAttach := TIdAttachment.Create(idMessage.MessageParts, vPathTemp + vNomArxiu);
vIdAttach.ContentType := 'image/jpeg';
vIdAttach.ContentDisposition := 'inline';
vIdAttach.ExtraHeaders.Values['content-id'] := vNomArxiu;
vIdAttach.DisplayName := vNomArxiu;
end;
 
idMessage.Body.Assign(slBody);
 
with idSMTP do begin
Host := 'MiHost';
Port := 25;
HeloName := 'Loquesea';
AuthenticationType := atLogin;
Username := 'MiUsuario';
Password := 'MiPassword';
Connect();
Send(IdMessage);
end;


Gracias de antemano
Responder Con Cita
  #2  
Antiguo 08-11-2007
Nayla Nayla is offline
Registrado
 
Registrado: nov 2007
Posts: 9
Poder: 0
Nayla Va por buen camino
Perdon que no dije que lo que me pasa con el codigo anterior es que recibo un mail con dos attachment, uno de texto, y otro con la imagen.

No consigo que funcione bien todavia
Responder Con Cita
  #3  
Antiguo 08-11-2007
Avatar de gluglu
[gluglu] gluglu is offline
Miembro Premium
 
Registrado: sep 2004
Ubicación: Málaga - España
Posts: 1.455
Poder: 23
gluglu Va por buen camino
Echale un vistazo a este documento.

En él se explica perfectamente todos los tipos de mensajes, y como definirlos correctamente.

Saludos
__________________
Piensa siempre en positivo !
Responder Con Cita
  #4  
Antiguo 08-11-2007
Nayla Nayla is offline
Registrado
 
Registrado: nov 2007
Posts: 9
Poder: 0
Nayla Va por buen camino
Gracias gluglu

pero me he mirado el documento que me enlazabas y sigo sin ver el error

Los mails que recibo me salen con estas opciones de cabecera:
This is a multi-part message in MIME format
--=_NextPart_2relrfksadvnqindyw3nerasdf
Content-Type: text/plain
Content-Transfer-Encoding: 7bit
--=_NextPart_2relrfksadvnqindyw3nerasdf
Content-Type: image/jpeg;
name="logo_endesa.jpg"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
filename="logo_endesa.jpg"
content-id: logo_endesa.jpg
--=_NextPart_2relrfksadvnqindyw3nerasdf--
Parece como si estuviera "pasando" de esta parte del codigo que le pongo:

Código Delphi [-]
  vIdText := TidText.Create(idMessage.MessageParts, slBody);
  vIdText.ContentType := 'text/html';

O no se, hay alguna cosa que se me escapa y que no entiendo lo que esta pasando.
Responder Con Cita
  #5  
Antiguo 08-11-2007
Avatar de gluglu
[gluglu] gluglu is offline
Miembro Premium
 
Registrado: sep 2004
Ubicación: Málaga - España
Posts: 1.455
Poder: 23
gluglu Va por buen camino
Cuando yo mando un mensaje con imágenes dentro del texto HTML, mi cabecera del mensaje es la siguiente :

Cita:
This is a multi-part message in MIME format
--caML6cRopV0jyVq6oi0rFDqp=_13MyJWkT
Content-Type: text/html ; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<html><body>
<img src=3D"cid:0001">

....
....

--caML6cRopV0jyVq6oi0rFDqp=_13MyJWkT
Content-Type: image/jpeg;
name="AT0001.JPG"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="AT0001.JPG"
Content-ID: 0001
A mi al menos me funciona perfectamente de esta manera. Y mira que en su momento hice muchísimas pruebas. Compara mi cabecera con la que tu expones y a ver si te ayuda en algo. Está claro que la forma de usarlo es diferente.

Espero que te sirva de ayuda.
__________________
Piensa siempre en positivo !
Responder Con Cita
  #6  
Antiguo 08-11-2007
Nayla Nayla is offline
Registrado
 
Registrado: nov 2007
Posts: 9
Poder: 0
Nayla Va por buen camino
Ya si yo lo que digo es que a pesar de que le estoy intentando forzar a que el content-type del idtext sea "text/html" me sigue saliendo "text/plain" y no sé por qué
Responder Con Cita
  #7  
Antiguo 08-11-2007
Avatar de gluglu
[gluglu] gluglu is offline
Miembro Premium
 
Registrado: sep 2004
Ubicación: Málaga - España
Posts: 1.455
Poder: 23
gluglu Va por buen camino
He revisado mi código :

Código Delphi [-]
IdMessage1.ContentType := 'multipart/related; type="text/html"';
 
...
 
// Just HTML Text, No Attachments, No Embedded Images
MessageType := 1;
IdMessage1.ContentType := 'multipart/alternative';
...
// HTML Text + Attachments, No Embedded Images
MessageType := 2;
IdMessage1.ContentType := 'multipart/mixed';
...
// HTML Text + Attachments + Embedded Images
MessageType := 3;
IdMessage1.ContentType := 'multipart/mixed';
with TIdText.Create(IdMessage1.MessageParts, nil) do begin
  ContentType := 'multipart/related; type="multipart/alternative"';
end;
with TIdText.Create(IdMessage1.MessageParts, nil) do begin
  ContentType := 'multipart/alternative';
  ParentPart := 0;
end;
...
// HTML Text + Embedded Images, No Attachments
MessageType := 4;
IdMessage1.ContentType := 'multipart/related; type="text/html"';

// MessageType
// 1 = Only Text HTML
// 2 = Text + File Attachments
// 3 = Text + File Attachments + Embedded Images
// 4 = Text + Embedded Images
 
with TIdText.Create(IdMessage1.MessageParts, nil) do begin
  Body.Assign(html);
  ContentType := 'text/html';
  if MessageType = 3 then ParentPart := 1;
  CharSet     := 'iso-8859-1';
end;
 
with TIdAttachmentFile.Create(IdMessage1.MessageParts, 'C:\AT0001.JPG') do begin
  ContentID   := '0001';
  ContentType := 'image/jpeg';
  FileName    := 'AT0001.JPG';
  if MessageType = 3 then ParentPart := 0;
end;

with TIdAttachmentFile.Create(IdMessage1.MessageParts, 'C:\AT0002.JPG') do begin
  ContentID   := '0002';
  ContentType := 'image/jpeg';
  FileName    := 'AT0002.JPG';
  if MessageType = 3 then ParentPart := 0;
end;

A ver si con estas líneas de código ya te funciona.
__________________
Piensa siempre en positivo !
Responder Con Cita
Respuesta


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
Como puedo guardar una imagen dentro de una tabla jooooseph Gráficos 3 13-10-2007 02:11:56
Pegar una imagen en un doc gabyzava Varios 3 17-08-2007 18:54:07
Copiar pegar y cortar una imagen!!!! Juangu Gráficos 4 09-06-2005 18:28:24
como puedo Agregar un Archivo en un mail carlosmoralesm Internet 4 05-05-2004 12:12:19
pegar imagen a word desde delphi ciscu Servers 3 14-01-2004 12:00:52


La franja horaria es GMT +2. Ahora son las 10:45:14.


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