Fórum IdMessage- Como anexar arquivos em meu e-mail no delphi 7? #243813
20/07/2004
0
Valeu, até mais....

Vagner Monteiro
Curtir tópico
+ 0Posts
20/07/2004
Guibas
Gostei + 0
21/07/2004
Everton
1 | TIdAttachment.Create(IdMessage.MessageParts, Nome_do_Arquivo); |
Gostei + 0
17/01/2021
Victor
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
17/01/2021
Emerson Nascimento
1 2 3 | //Manipulando os Anexos for anexo := 0 to lbxAnexos . Items . Count- 1 do TIdAttachment . Create(Data . MessageParts, lbxAnexos . Items[anexo]); |
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)