Jump to content


Photo

Enviar Adjuntos por correo


  • Please log in to reply
2 replies to this topic

#1 egostar

egostar

    missing my father, I love my mother.

  • Administrador
  • 14448 posts
  • LocationMéxico

Posted 03 October 2019 - 11:14 AM

Pues eso amigos,
 
Tengo un código muy simple pero que no funciona por nada, la intención es enviar adjuntos en un correo, estoy utilizando Indy 10.6
 
 

delphi
  1. var
  2.   IdSMTP1: TIdSMTP;
  3.   Mens: TIdMessage;
  4.   Att := TIdAttachmentFile;
  5. begin
  6.   if FileExists(Attachment) then
  7.   begin
  8.     Att := TIdAttachmentFile.Create(Mens.MessageParts, 'C:\Temp\Test.jpg');
  9.     //-------------------------------------------------------------------------
  10.     // Líneas opcionales
  11.     //-------------------------------------------------------------------------
  12.     Att.ContentTransfer := 'base64';
  13.     Att.ContentType := 'image/jpeg';
  14.     Att.ContentDisposition := 'inline';
  15.     Att.ParentPart := 0;
  16.     //-------------------------------------------------------------------------
  17.     Mens.MessageParts.Add;
  18.     Att.Free;
  19.   end
  20.   IdSMTP1.Connect;
  21.   IdSMTP1.Send(Mens);
  22.   IdSMTP1.Disconnect();
  23. end;

 
Me llega el correo correctamente pero sin adjunto :(
 
¿Hay algo que no estoy contemplando?
 
Saludos
  • 0

#2 egostar

egostar

    missing my father, I love my mother.

  • Administrador
  • 14448 posts
  • LocationMéxico

Posted 03 October 2019 - 11:23 AM

Vaya, me respondo solo viendo un hilo aquí mismo....
 


delphi
  1. var
  2.   IdSMTP1: TIdSMTP;
  3.   Mens: TIdMessage;
  4. begin
  5.   if FileExists(Attachment) then
  6.     TIdAttachmentFile.Create(Mens.MessageParts, 'C:\Temp\Test.jpg');
  7.   IdSMTP1.Connect;
  8.   IdSMTP1.Send(Mens);
  9.   IdSMTP1.Disconnect();
  10. end;

Quité toda la "basura" que afectaba el proceso y así de simple quedó.

Saludos (y)


  • 0

#3 porfi.dev

porfi.dev

    Advanced Member

  • Miembros
  • PipPipPip
  • 183 posts
  • LocationMy House @ México

Posted 07 October 2019 - 08:11 PM

Gracias hermano, ahora que veo este código se parece mucho a objetive-C :o


  • 1




IP.Board spam blocked by CleanTalk.