Ver Mensaje Individual
  #3  
Antiguo 11-05-2014
Avellas Avellas is offline
Miembro
 
Registrado: feb 2005
Posts: 31
Reputación: 0
Avellas Va por buen camino
Código Delphi [-]
Procedure TFrmEnviar.EnviarCorreo;
var
  Password: String;
  ledAttachment: String;
Begin
  IdMessage.Clear;
  Password := TRIM(QryCorreoOrigenCLAVE.AsString);
  IdMessage.FromList.EMailAddresses := TRIM(QryCorreoOrigenEMAILORIGEN.AsString);   //correo desde el que envia
    IdMessage.Recipients.EMailAddresses := Trim(EdtDestino.Text); 

  IdMessage.Subject := Trim(EdtAsunto.Text);
  IdMessage.Body.AddStrings(Memo1.Lines);
  ledAttachment := (ExtractFilePath(ParamStr(0)) + 'BROCHURE' + '.PDF');
//  ledAttachment := Trim(EdtAdjunto.Text);
  if ledAttachment <> '' then
  Begin
     TIdAttachmentfile.Create(IdMessage.MessageParts, ledAttachment);
   end
   else
     ledAttachment := '';

  IdSMTP.Username := Trim(QryCorreoOrigenEMAILORIGEN.AsString); // ;
  IdSMTP.Password := Password;

  try
    if not IdSMTP.Connected then
      IdSMTP.Connect;


    Try
       IdSMTP.Send(IdMessage);

      except

       On E: Exception do
         ShowMessage(E.Message);
       End;

  finally
      IdSMTP.Disconnect(True);

  end;
End;

Última edición por ecfisa fecha: 11-05-2014 a las 23:53:16. Razón: Etiquetas [DELPHI] [/DELPHI]
Responder Con Cita