Hola, estoy intentando realizar una función que envíe mails y al final de dicho mail, estampe una firma la cual tiene un logo. Ya he probado de mil formas y lo que mejor sale es la firma en el cuerpo del mail, pero la firma va además como archivo adjunto y en el cuerpo el nombre del archivo que contiene dicha firma.
He aquí lo mas cercano que logre:
Código Delphi
[-]procedure TForm1.ENVIAR;
VAR
I:INTEGER;
html: TStrings;
filename: string;
begin
filename := ExtractFilePath(Application.ExeName) + 'Sello Mario Transparente.PNG';
SMTP.Port := 25;
SMTP.Host := HOST;
SMTP.Username := USERNAME;
SMTP.Password := CLAVE;
try
MAIL.Recipients.Add;
MAIL.Recipients[0].Name := EMPRESA;
MAIL.Recipients[0].Address := DESTINO;
MAIL.Recipients.Add;
MAIL.Recipients[1].Name := 'Copia de datos enviados al Contador';
MAIL.Recipients[1].Address := COPIA;
MAIL.From.Name := EMPRESA;
MAIL.From.Address := DESTINO;
mail.ContentType:='multipart/mixed';
with TIdMessageBuilderHtml.Create do
try
Html.Text := 'Adjunto datos';
HtmlFiles.Add(filename);
Attachments.Add(filename);
FillMessage(mail);
finally
Free;
end;
if ARCHIVOS.Items.Count >= 0 then
for I:=0 TO ARCHIVOS.Items.Count - 1 do TIdAttachmentFile.Create(mail.MessageParts,ARCHIVOS.Items[i]);
try
SMTP.Connect;
SMTP.Send(mail);
if SMTP.Connected then
BEGIN
SMTP.Disconnect;
SHOWMESSAGE('MAIL ENVIADO EXITOSAMENTE');
end;
except
on E: Exception do SHOWMESSAGE(E.Message);
end;
MAIL.Clear;
except
on E: Exception do SHOWMESSAGE(E.Message);
end;
end;
Agradecería si alguien sabe como resolver esto.
Saludos
Mario