Jump to content

Envio de email


Monteiro
 Share

Recommended Posts

  • 2 months later...

Monteiro,

 

Para enviar um e-mail, você pode utilizar os componentes IdSMTP normalmente.

 

Segue exemplo:

 

procedure TMainForm.EnviarEmail;
var
  Email: TIdMessage;
begin
  Email := TIdMessage.Create(nil);
  Email.Subject := 'Credenciamento';
  Email.Body.Add('Ola, ' + EdtNome.Text + ' voce se credenciou');
  Email.Body.Add('');
  Email.Body.Add('Confira seus dados, e entre em contato conosco em caso de erro.');
  Email.Body.Add('CPF: ' + EdtCPF.Text);
  Email.Body.Add('Telefone: ' + EdtCelular.Text);
  Email.Body.Add('');
  Email.Body.Add('A equipe agradece seu cadastro, em breve, entraremos em contato.');
  Email.Body.Add('');
  Email.Sender.Address := 'atendimento@xxxx';
  Email.From.Address := 'atendimento@xxxx';
  Email.ReplyTo.Add.Address := 'atendimento@xxxx';
  Email.Encoding := meMIME;
  Email.Recipients.Clear;
  Email.Recipients.EMailAddresses := EdtEmail.Text;
  Email.BccList.EMailAddresses := xxxx@xxxx';
 
  if not IdSMTPMain.Connected then
  begin
    try
      IdSMTPMain.Connect;
      IdSMTPMain.Send(Email);
    finally
      IdSMTPMain.Disconnect(True);
    end;
  end;
 
end;
 
Atenciosamente,
Possidônio Oliveira.
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...