Se usa delphi 5 ou 6 e deseja usar o cliente default do windows, pode 
ainda usar o Mail a biblioteca Jedi
que envia inclusive em modo silent!!!
[] Emanuel
Andrei Luís escreveu:
>
> Alex,
>
> A rotina abaixo gera uma nova msg no cliente de e-mail default do windows.
> Se passar o parâmetro confirma como false, ele envia a msg 
> automaticamente,
> se passar como true o e-mail é mostrado em tela, com tudo pronto,
> destinatario, assunto, corpo e anexo, só faltando clicar no botão enviar.
>
> []
> Andrei
>
> function EnviarEMail(const De, Para, CC, Assunto, Texto, Arquivo:string;
> Confirma: Boolean): Integer;
> var
> Msg: TMapiMessage;
> lpSender, lpRecepient, lpComCopia: 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); //Corpo da Mensagem
>
> // 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;
> if (CC <> '') then
> begin
> lpComCopia.ulRecipClass := MAPI_CC;
> lpComCopia.lpszName := PChar(CC);
> lpComCopia.lpszAddress := PChar(CC);
> lpComCopia.ulReserved := 0;
> lpComCopia.ulEIDSize := 0;
> lpComCopia.lpEntryID := nil;
> nRecipCount := 2;
> lpRecips := @lpComCopia;
> 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;
>
> 2008/9/28 Alex Leão <[EMAIL PROTECTED] 
> <mailto:alex_fib%40yahoo.com.br>>
>
> > Pessoal,
> >
> > Preciso que meu sistema envie relatórios por e-mail. A parte de gerar e
> > salvar o relatótio eu já fiz, mas a parte de enviar o e-mail tá 
> lenha ...
> >
> > Alguém tem alguma rotina para me ajudar?
> >
>
> [As partes desta mensagem que não continham texto foram removidas]
>
>  


Responder a