Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Internet (https://www.clubdelphi.com/foros/forumdisplay.php?f=3)
-   -   Correo Indy Ejemplo (https://www.clubdelphi.com/foros/showthread.php?t=64488)

dfarias 03-04-2009 17:40:43

Correo Indy Ejemplo
 
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.:o

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 ; // Raise Window. 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;


La franja horaria es GMT +2. Ahora son las 20:18:03.

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