GARANTIR DESCONTO

Fórum Enviar E-Mail #258986

18/11/2004

0

Eu tenho essa função que envia e-mail pelo outlook:

[color=blue:c66766329c][i:c66766329c]function EnviarEmail(const De, Para, Assunto, Texto, Arquivo: string): Integer;
var
Msg: TMapiMessage;
lpSender, lpRecepient: TMapiRecipDesc;
FileAttach: TMapiFileDesc;
SM: TFNMapiSendMail;
MAPIModule: HModule;
I: Integer;
begin
FillChar(Msg, SizeOf(Msg), 0);
with Msg do
begin
if (Assunto ´´) then lpszSubject:=PChar(Assunto);
if (Texto ´´) then lpszNoteText:=PChar(Texto);
if (De ´´) then
begin
lpSender.ulRecipClass:=MAPI_ORIG;
lpSender.lpszName:=PChar(De);
lpSender.lpszAddress:=PChar(De);
lpSender.ulReserved:=0;
lpSender.ulEIDSize:=0;
lpSender.lpEntryID:=nil;
lpOriginator:=@lpSender;
end;
if (Para ´´) then
begin
lpRecepient.ulRecipClass:=MAPI_TO;
lpRecepient.lpszName:=PChar(Para);
lpRecepient.lpszAddress:=PChar(Para);
lpRecepient.ulReserved:=0;
lpRecepient.ulEIDSize:=0;
lpRecepient.lpEntryID:=nil;
nRecipCount:=1;
lpRecips:=@lpRecepient;
end else
lpRecips:=nil;
if (Arquivo = ´´) then
begin
nFileCount:=0;
lpFiles:=nil;
end else
begin
FillChar(FileAttach, SizeOf(FileAttach), 0);
FileAttach.nPosition:=Cardinal($FFFFFFFF);
FileAttach.lpszPathName:=PChar(Arquivo);
nFileCount:= 1;
lpFiles:=@FileAttach;
end;
end;
MAPIModule:=LoadLibrary(PChar(MAPIDLL));
if MAPIModule=0 then
Result := -1 else
try
@SM := GetProcAddress(MAPIModule, ´MAPISendMail´);
if @SM nil then
Result := SM(0, Application.Handle, Msg, MAPI_DIALOG or MAPI_LOGON_UI, 0) else
Result := 1;
finally
FreeLibrary(MAPIModule);
end;
if Result 0 then
MessageDlg(´Erro ao Enviar o E-Mail (´ + IntToStr(Result) + ´).´, mtError, [mbOK], 0);
end;[/i:c66766329c][/color:c66766329c]


Só que alguém sabe como eu posso fazer para mandar mais arquivos em anexo, ela só funciona anexando 1 arquivo.


Blbacelar

Blbacelar

Responder

Utilizamos cookies para fornecer uma melhor experiência para nossos usuários, consulte nossa política de privacidade.

Aceitar