Chamar programa de envio de Email padrão Rad Studio XE8
Bom dia pessoal,
Estou tentando fazer o envio de e-mail abrir o programa de e-mail padrão do computador e no xe8 não esta funcionando...
Uso a mesma função que faço isso com o Delphi 7 e funciona normalmente, porém com o XE8 não esta funcionando
Alguém sabe o que pode ser ?
Segue função...
Estou tentando fazer o envio de e-mail abrir o programa de e-mail padrão do computador e no xe8 não esta funcionando...
Uso a mesma função que faço isso com o Delphi 7 e funciona normalmente, porém com o XE8 não esta funcionando
Alguém sabe o que pode ser ?
Segue função...
function EnviarEMail(const De, Para, Assunto, Texto, Arquivo: string;
Confirma: Boolean): Integer;
var
Msg: TMapiMessage;
lpSender, lpRecepient: TMapiRecipDesc;
FileAttach: TMapiFileDesc;
SM: TFNMapiSendMail;
MAPIModule: HModule;
Flags: Cardinal;
begin
// Cria Propriedades da Mensagem
FillChar(Msg, SizeOf(Msg), 0);
with Msg do
begin
if (Assunto <> '') then
lpszSubject := PAnsiChar(Assunto);
if (Texto <> '') then
lpszNoteText := PAnsiChar(Texto);
// Remetente
if (De <> '') then
begin
lpSender.ulRecipClass := MAPI_ORIG;
lpSender.lpszName := PAnsiChar(De);
lpSender.lpszAddress := PAnsiChar(De);
lpSender.ulReserved := 0;
lpSender.ulEIDSize := 0;
lpSender.lpEntryID := nil;
lpOriginator := @lpSender;
end;
// Destinatário
if (Para <> '') then
begin
lpRecepient.ulRecipClass := MAPI_TO;
lpRecepient.lpszName := PAnsiChar(Para);
lpRecepient.lpszAddress := PAnsiChar(Para);
lpRecepient.ulReserved := 0;
lpRecepient.ulEIDSize := 0;
lpRecepient.lpEntryID := nil;
nRecipCount := 1;
lpRecips := @lpRecepient;
end else
lpRecips := nil;
// arquivo anexo
if (Arquivo = '') then
begin
nFileCount := 0;
lpFiles := nil;
end else
begin
FillChar(FileAttach, SizeOf(FileAttach), 0);
FileAttach.nPosition := Cardinal($FFFFFFFF);
FileAttach.lpszPathName := PAnsiChar(Arquivo);
nFileCount := 1;
lpFiles := @FileAttach;
end;
end;
// Carrega DLL e o Método para Envio do Email
MAPIModule := LoadLibrary(PChar(MAPIDLL));
if (MAPIModule = 0) then
Result := -1
else
begin
try
if (Confirma) then
Flags := MAPI_DIALOG or MAPI_LOGON_UI
else
Flags := 0;
@SM := GetProcAddress(MAPIModule, 'MAPISendMail');
if (@SM <> nil) then
Result := SM(0, Application.Handle, Msg, Flags, 0)
else
Result := 1;
finally
FreeLibrary(MAPIModule);
end;
end;
end;
Ari Junior
Curtidas 0