receber email no delphi
galera tenho o seguinte código para envio de email
procedure TFrmConfEmail.BitBtn1Click(Sender: TObject);
var
i:integer;
messageemail:string;
begin
progresso:=1;
try
tmr1.Enabled:=True;
cancelar := false;
Screen.Cursor := crHourGlass;
Screen.Cursor := crHourGlass;
IdSMTP1.Host := edtServidorSMTP.Text;
IdSMTP1.Username := edtUsuarioServ.Text;
IdSMTP1.Password := edtSenhaServ.Text;
IdSMTP1.Port := StrToInt(edtPortaServ.Text);
// servidor requer autenticacao
if chkServerRequerAut.Checked then
IdSMTP1.AuthenticationType:= atLogin
else
IdSMTP1.AuthenticationType:= atNone;
// utilizar conexao segura SSL
if chkSSL.Checked then
IdSMTP1.IOHandler := IdSSLIOHandlerSocket1
else
IdSMTP1.IOHandler := nil;
IdMessage1.MessageParts.Clear;
// adicionando anexos do email a ser enviado
if Memo1.Lines.Count > 0 then begin
for i:= 0 to Memo1.Lines.Count - 1 do
TIdAttachment.Create(IdMessage1.MessageParts, Memo1.Lines[i]);
end;
// dados da origem do email
IdMessage1.From.Address := edtUsuarioServ.Text;
IdMessage1.Subject := edtAssunto.Text;
// dados do destino do email
IdMessage1.Body.Add('Razão social :Igreja do Evangelho Pleno');
IdMessage1.Body.Add('Enviado por '+edt_de.text);
IdMessage1.Body.Add('Referente:'+edtAssunto.Text);
IdMessage1.Body.Add('Para:'+edt_para.text);
IdMessage1.Recipients.EMailAddresses := edtContaEmail.Text;
IdMessage1.Body.Text := MemoMsg.text;
IdMessage1.BccList.EMailAddresses := '';
IdMessage1.CCList.EMailAddresses := '';
if NOT IdSMTP1.Connected then
IdSMTP1.Connect(2000);
if IdSMTP1.Connected then begin
//IdSMTP1.Authenticate;
IdSMTP1.Send(IdMessage1);
//Application.ProcessMessages;
if cancelar AND (Application.MessageBox('Deseja cancelar o processo?','Confirmação',mb_iconQuestion + mb_YesNo + mb_DefButton2) = mrYes) then
cancelar := false;
Application.ProcessMessages;
end;
IdSMTP1.Disconnect;
Screen.Cursor:= crDefault;
ShowMessage('E-mail Enviado com Sucesso!');
//Close;
Except
on E:Exception do begin
Screen.Cursor:= crDefault;
ShowMessage(E.Message);
end;
end;
end;
gostaria de saber como receber um emil caso alguem me envie
se possivel nessa estrutura
email de:
assunto:
message:
procedure TFrmConfEmail.BitBtn1Click(Sender: TObject);
var
i:integer;
messageemail:string;
begin
progresso:=1;
try
tmr1.Enabled:=True;
cancelar := false;
Screen.Cursor := crHourGlass;
Screen.Cursor := crHourGlass;
IdSMTP1.Host := edtServidorSMTP.Text;
IdSMTP1.Username := edtUsuarioServ.Text;
IdSMTP1.Password := edtSenhaServ.Text;
IdSMTP1.Port := StrToInt(edtPortaServ.Text);
// servidor requer autenticacao
if chkServerRequerAut.Checked then
IdSMTP1.AuthenticationType:= atLogin
else
IdSMTP1.AuthenticationType:= atNone;
// utilizar conexao segura SSL
if chkSSL.Checked then
IdSMTP1.IOHandler := IdSSLIOHandlerSocket1
else
IdSMTP1.IOHandler := nil;
IdMessage1.MessageParts.Clear;
// adicionando anexos do email a ser enviado
if Memo1.Lines.Count > 0 then begin
for i:= 0 to Memo1.Lines.Count - 1 do
TIdAttachment.Create(IdMessage1.MessageParts, Memo1.Lines[i]);
end;
// dados da origem do email
IdMessage1.From.Address := edtUsuarioServ.Text;
IdMessage1.Subject := edtAssunto.Text;
// dados do destino do email
IdMessage1.Body.Add('Razão social :Igreja do Evangelho Pleno');
IdMessage1.Body.Add('Enviado por '+edt_de.text);
IdMessage1.Body.Add('Referente:'+edtAssunto.Text);
IdMessage1.Body.Add('Para:'+edt_para.text);
IdMessage1.Recipients.EMailAddresses := edtContaEmail.Text;
IdMessage1.Body.Text := MemoMsg.text;
IdMessage1.BccList.EMailAddresses := '';
IdMessage1.CCList.EMailAddresses := '';
if NOT IdSMTP1.Connected then
IdSMTP1.Connect(2000);
if IdSMTP1.Connected then begin
//IdSMTP1.Authenticate;
IdSMTP1.Send(IdMessage1);
//Application.ProcessMessages;
if cancelar AND (Application.MessageBox('Deseja cancelar o processo?','Confirmação',mb_iconQuestion + mb_YesNo + mb_DefButton2) = mrYes) then
cancelar := false;
Application.ProcessMessages;
end;
IdSMTP1.Disconnect;
Screen.Cursor:= crDefault;
ShowMessage('E-mail Enviado com Sucesso!');
//Close;
Except
on E:Exception do begin
Screen.Cursor:= crDefault;
ShowMessage(E.Message);
end;
end;
end;
gostaria de saber como receber um emil caso alguem me envie
se possivel nessa estrutura
email de:
assunto:
message:
Jose Silva
Curtidas 0