Quebra de linha no outlook express
Fiz uma rotina para abrir o outlook, e montar um texto. Acontece que no outlook profissional ele fica certinho, mas no express ele não pula linha e e a mensagem sai toda emendada. Uso a seguinte 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 := PChar(Assunto);
if (Texto <> ´´) then
lpszNoteText := PChar(Texto);
// remetente
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;
// destinatário
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;
// arquivo anexo
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;
// carrega dll e o método para envio do email
MAPIModule := LoadLibrary(PChar(MAPIDLL));
if MAPIModule = 0 then
Result := -1
else
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;
e no botão eu uso o seguinte:
EnviarEMail(´de@email´, ´para@email, ´ASSUNTO´, bom dia + #13 + ´Segue anexo relatório semanal´ + 13 + ´Estamos a inteira diposição para maiores esclarecimentos´ + 13 + ´Sem mais, atenciosamente.´ + 13 + 13 + ´Caso necessário segue abaixo link gratuito para instalação do ADOBE READER, ´ + ´programa usado para leitura dos arquivos anexos´ + 13 + 13 + ´http://baixaki.ig.com.br/pesquisa.asp?nome=adobe+reader&tipo=1&img.x=26&img.y=11´,
´c:\arquivo.pdf´, true);
Note que coloquei o 13 na string para pular de linha, mas no outlook express não funciona, só no outlook do office. Alguém tem uma soluçã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 := PChar(Assunto);
if (Texto <> ´´) then
lpszNoteText := PChar(Texto);
// remetente
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;
// destinatário
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;
// arquivo anexo
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;
// carrega dll e o método para envio do email
MAPIModule := LoadLibrary(PChar(MAPIDLL));
if MAPIModule = 0 then
Result := -1
else
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;
e no botão eu uso o seguinte:
EnviarEMail(´de@email´, ´para@email, ´ASSUNTO´, bom dia + #13 + ´Segue anexo relatório semanal´ + 13 + ´Estamos a inteira diposição para maiores esclarecimentos´ + 13 + ´Sem mais, atenciosamente.´ + 13 + 13 + ´Caso necessário segue abaixo link gratuito para instalação do ADOBE READER, ´ + ´programa usado para leitura dos arquivos anexos´ + 13 + 13 + ´http://baixaki.ig.com.br/pesquisa.asp?nome=adobe+reader&tipo=1&img.x=26&img.y=11´,
´c:\arquivo.pdf´, true);
Note que coloquei o 13 na string para pular de linha, mas no outlook express não funciona, só no outlook do office. Alguém tem uma solução?
Roberto Rossi
Curtidas 0
Respostas
Massuda
15/01/2007
Experimente usar #1310 ao invés de 13 apenas.
GOSTEI 0