Caro amigo, estou com mesmo problema, no thunderbird não funfa de jeito 
nenhum, no outlook express funciona e deve funcionar também no outlook, 
mas não testei ainda. Não testei com outros programas para saber o 
resultado. Em quais programas tu testaste o código?

Alan Vieceli escreveu:
> To com um galho, to a uns 2 dias tentando resolver e não consigo...
> 
> preciso montar um e-mail pra enviar usando o programa de e-mail padrão 
> instalado no computador...
> dai eu fiz essa procedure:
> 
> procedure PrepararEmail(Para, Assunto, Msg: string);
> var
>   S: string;
>   wsl : TStringList;
> begin
>   S := 'mailto:' + Para + '?subject=' + Assunto + '&body="'+wsl.Text+'"'+
>        '&[EMAIL PROTECTED]&[EMAIL PROTECTED]';
>   ShellExecute(0, 'open', PChar(S), nil, nil, SW_SHOWNORMAL);
> end;
> 
> 
> Essa procedure acima funciona em Outlook, Thunderbird e IncrediMail, 
> perfeito... mas ai apareceu um problema...eu precisava mandar um arquivo 
> anexo...essa função "mailto" não manda anexo.
> 
> Dai eu fiz isso:
> 
> //XXXXXXXXXXXXXXXXXXXXXXXXX 
> 
>  TMailDTO = class(TPersistent)
>   private
>     FSubject: String;
>     FToRecipients: TStringList;
>     FCCRecipients: TStringList;
>     FAttachments: TStringList;
>     FCCoRecipients: TStringList;
>     FBody: TStringList;
>     FCharSet: String;
>     FHighPriority: boolean;
>     FContentType: String;
>     FReplyTo: TStringList;
>     FTempFile: String;
>     procedure SetTempFile(const Value: String);
>     procedure SetCharSet(const Value: String);
>     procedure SetContentType(const Value: String);
>     procedure SetHighPriority(const Value: boolean);
>     procedure SetSubject(const Value: String);
>   public
>     property Subject : String read FSubject write SetSubject;
>     property ToRecipients: TStringList read FToRecipients;
>     property CCRecipients: TStringList read FCCRecipients;
>     property CCoRecipients: TStringList read FCCoRecipients;
>     property Body: TStringList read FBody;
>     property ContentType: String read FContentType write SetContentType;
>     property ReplyTo: TStringList read FReplyTo;
>     property HighPriority: boolean read FHighPriority write SetHighPriority;
>     property CharSet: String read FCharSet write SetCharSet;
>     property Attachments : TStringList read FAttachments;
>     property TempFile : String read FTempFile write SetTempFile;
>     constructor Create;
>     destructor Destroy;
>   end;
> 
> //XXXXXXXXXXXXXXXXXXXXXXXXX 
> 
> DataModulo
> 
> //XXXXXXXXXXXXXXXXXXXXXXXXX
> 
> unit Unit2;
> 
> interface
> 
> uses
>   SysUtils, Classes, IdBaseComponent, IdMessageParts, IdMessage, Unit1,
>   IdEMailAddress, IdAttachment, ShellAPI, Windows, IdAttachmentFile;
> 
> type
>   TDMMAPIMail = class(TDataModule)
>     IdMessage1: TIdMessage;
>   private
>     procedure AddToAddressList(AnAddressList: TIDEMailAddressList; 
> AStringList: TStringList);
>     procedure AddToAttachmentList(AMessageParts: TIdMessageParts; 
> AStringList: TStringList);
>     { Private declarations }
>   public
>     procedure SendMail(AMailDTO: TMailDTO);
>     { Public declarations }
>   end;
> 
> var
>   DMMAPIMail: TDMMAPIMail;
> 
> implementation
> 
> {$R *.dfm}
> 
> procedure TDMMAPIMail.AddToAddressList(AnAddressList: 
> TIDEMailAddressList; AStringList: TStringList);
> var
>   tempStr: String;
>   addressItem: TIdEMailAddressItem;
> begin
>   for tempStr in AStringList do
>     begin
>     if(Trim(tempStr) <> '') then
>       begin
>       addressItem := AnAddressList.Add;
>       addressItem.Address := tempStr;
>       addressItem.Name := tempStr;
>     end;
>   end;
> end;
> 
> procedure TDMMAPIMail.AddToAttachmentList(AMessageParts: 
> TIdMessageParts; AStringList: TStringList);
> var
>   tempStr: String;
> begin
>   for tempStr in AStringList do
>     begin
>     if(Trim(tempStr) <> '') then
>       begin
>       if ( FileExists(tempStr) ) then
>          TIdAttachmentFile.Create(AMessageParts,tempStr)
>       end;
>   end;
> end;
> 
> procedure TDMMAPIMail.SendMail(AMailDTO: TMailDTO);
> begin
>   IdMessage1.Subject := AMailDTO.Subject;
>   IdMessage1.CharSet := AMailDTO.CharSet;
>   IdMessage1.ContentType := AMailDTO.ContentType;
>   IdMessage1.Body.Text := AMailDTO.Body.Text;
>   IdMessage1.Headers.Add('X-Unsent: 1');
> 
>   IdMessage1.Date := Now;
> 
>   AddToAddressList(IdMessage1.Recipients,AMailDTO.ToRecipients);
>   AddToAddressList(IdMessage1.CCList,AMailDTO.CCRecipients);
>   AddToAddressList(IdMessage1.BccList,AMailDTO.CCoRecipients);
>   AddToAddressList(IdMessage1.ReplyTo,AMailDTO.ReplyTo);
> 
>   AddToAttachmentList(IdMessage1.MessageParts,AMailDTO.Attachments);
> //
> //  try
>   IdMessage1.SaveToFile(AMailDTO.TempFile,false);
> //  except
> //  end;
>  
>   ShellExecute(0, 'open', PChar(AMailDTO.TempFile), '','', SW_SHOWNORMAL);
> end;
> 
> end.
> 
> //XXXXXXXXXXXXXXXXXXXXXXXXX
> 
> O probleama aqui é...de onde eu peguei esse código, diz q esse Header:   
> "X-Unsent: 1" q ele ficaria pendende de envio, mas ele fica como se 
> tivesse lido, ou seja..não consigo enviar....
> 
> acho q expliquei bem o problema...se alguem puder me dar uma ajuda.
> 
> Abraço
> 
__________________________________________________
Faça ligações para outros computadores com o novo Yahoo! Messenger 
http://br.beta.messenger.yahoo.com/ 

Responder a