Hola colegas. Aqui dejo un ejemplo de envio de correo con logo, texto html y adjunto. Este funciona casi perfecto , segun mi cliente hay destinatarios que no reciben el adjunto. A mi me funciona perfecto. A ver si alguin se da cuenta por que.
Código Delphi
[-]
procedure TfrmMailing.ArmaHtml;
var
buffer,s:string;
x:integer;
begin
Logofilename := ExtractFilePath(Application.ExeName) + 'logo.jpg';
html := TStringList.Create();
html.Add('');
html.Add('');
html.Add('');
html.Add('');
html.Add('
');
for x:=0 to memo1.Lines.Count-1 do
begin
html.Add(''
+ memo1.lines.strings[x] + '' );
end;
html.Add('
');
html.Add('');
html.Add('');
end;
procedure TfrmMailing.CorreoMasivo;
var
RW: TRaiseWin ; x:integer;
begin
armahtml;
x:=0;
qry.First;
while not qry.eof do
begin
rzMensa.Caption:= 'Enviando... Espere por favor';
...
oEmail.SendMail(oMailC.from, qry.fieldbyname('email').asstring , oMailC.MailCC, txtAsunto.Text , html , Logofilename, txtAdjuntar.Text)
procedure SetupMail(From, To_, CC, Subject: String; Body: TStrings; logo:string ; adjunto:string = '');
begin
fEmsg.ContentType := 'multipart/mixed';
fEmsg.Body.Assign(body);
partettxt := TIdText.Create(fEmsg.MessageParts);
partettxt.ContentType := 'text/plain';
partettxt.Body.Text := '';
partehtml := TIdText.Create(fEmsg.MessageParts, body);
partehtml.ContentType := 'text/html';
partejpg := TIdAttachment.Create(fEmsg.MessageParts, logo);
partejpg.ContentType := 'image/jpeg';
partejpg.FileIsTempFile := false;
partejpg.ContentDisposition := 'inline';
partejpg.ExtraHeaders.Values['content-id'] := 'logo.jpg';
partejpg.DisplayName := 'logo.jpg';
if adjunto > '' then
begin
jpg2 := TIdAttachment.Create(fEmsg.MessageParts, adjunto);
jpg2.ContentType := 'image/jpeg';
jpg2.FileIsTempFile := false;
jpg2.ContentDisposition := 'inline';
jpg2.ExtraHeaders.Values['content-id'] := adjunto;
jpg2.DisplayName := adjunto;
end;
fEmsg.From.Address := From ;
fEmsg.Recipients.EMailAddresses := To_ + ',' + CC;
fEmsg.Subject := Subject ;
end;