IdMessage- Como anexar arquivos em meu e-mail no delphi 7?
Oi pessoal,eu gostaria de adicionar anexos no meu e-mail, algué saberia como fazer isto?Desde já obrigado.
Valeu, até mais....
Valeu, até mais....

Vagner Monteiro
Curtidas 0
Respostas

Guibas
20/07/2004
ve uma propriedade attachment (algo assim) e pesquisa no forum que tem vários tópicos sobre esse assunto.
GOSTEI 0

Everton
20/07/2004
Use o comando abaixo:
TIdAttachment.Create(IdMessage.MessageParts, Nome_do_Arquivo);
GOSTEI 0

Victor
20/07/2004
Pra mim não está reconhecendo o TIdAttachment.Create... Fica dando linha vermelha:
Estou usando este código. E com essa forma, eu posso arquivar qualquer arquivo? Foto, PDF, txt, word, excel?
var
DATA: TIdMessage;
SMTP: TIdSMTP;
SSL: TIdSSLIOHandlerSocketOpenSSL;
anexo:integer;
begin
SMTP := TIdSMTP.Create(nil);
DATA := TIdMessage.Create(nil);
SSL := TIdSSLIOHandlerSocketOpenSSL.Create(nil);
SSL.SSLOptions.Method := sslvTLSv1;
SSL.SSLOptions.Mode := sslmUnassigned;
SSL.SSLOptions.VerifyMode := [];
SSL.SSLOptions.VerifyDepth := 0;
DATA.From.Address := 'victor.flourenco@outlook.com';
DATA.Recipients.EMailAddresses := 'vera.ferreira.silva@outlook.com';
DATA.subject := subject;
DATA.body.Text := body;
//Manipulando os Anexos
for anexo := 0 to lbxAnexos.Items.Count-1 do
Data.TIdAttachment.Create(IdMessage.MessageParts, anexo);
SMTP.IOHandler := SSL;
SMTP.Host := 'smtp.outlook.com';
SMTP.Port := 587;
SMTP.Username := '';
SMTP.Password := '';
SMTP.UseTLS := utUseExplicitTLS;
SMTP.Connect;
SMTP.Send(DATA);
SMTP.Disconnect;
SMTP.Free;
DATA.Free;
end;
Estou usando este código. E com essa forma, eu posso arquivar qualquer arquivo? Foto, PDF, txt, word, excel?
var
DATA: TIdMessage;
SMTP: TIdSMTP;
SSL: TIdSSLIOHandlerSocketOpenSSL;
anexo:integer;
begin
SMTP := TIdSMTP.Create(nil);
DATA := TIdMessage.Create(nil);
SSL := TIdSSLIOHandlerSocketOpenSSL.Create(nil);
SSL.SSLOptions.Method := sslvTLSv1;
SSL.SSLOptions.Mode := sslmUnassigned;
SSL.SSLOptions.VerifyMode := [];
SSL.SSLOptions.VerifyDepth := 0;
DATA.From.Address := 'victor.flourenco@outlook.com';
DATA.Recipients.EMailAddresses := 'vera.ferreira.silva@outlook.com';
DATA.subject := subject;
DATA.body.Text := body;
//Manipulando os Anexos
for anexo := 0 to lbxAnexos.Items.Count-1 do
Data.TIdAttachment.Create(IdMessage.MessageParts, anexo);
SMTP.IOHandler := SSL;
SMTP.Host := 'smtp.outlook.com';
SMTP.Port := 587;
SMTP.Username := '';
SMTP.Password := '';
SMTP.UseTLS := utUseExplicitTLS;
SMTP.Connect;
SMTP.Send(DATA);
SMTP.Disconnect;
SMTP.Free;
DATA.Free;
end;
GOSTEI 0

Emerson Nascimento
20/07/2004
seguindo exemplo passado anteriormente, deveria ser:
//Manipulando os Anexos for anexo := 0 to lbxAnexos.Items.Count-1 do TIdAttachment.Create(Data.MessageParts, lbxAnexos.Items[anexo]);
GOSTEI 0