• 0
Sign in to follow this  
dhyeggo

Problemas Na Rotina

Question

alguém poderia me ajudar com essa rotina, eu estou criando um sistema para envio de e-mail pelo delphi, uma mala direta, que através dos dados preenchidos na form e clicado em enviar vão para o microsoft outlook, estou com problemas no momento de anexar alguém poderia me ajudar, codigo ai problemas nas linhas de vermelho

unit OutLookMail;

interface

USES

Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,

Outlook8, OleServer, COMobj, ActiveX;

type

  TMailRecord= record

    Para        : String;

    Cc          : String;

    BCC          : String;

    Anexar      : String;

    Assunto      : String;

    Body        : String;

  end;

procedure OutLookMailProc(MailDetail:TMailRecord);

implementation

procedure OutLookMailProc(MailDetail:TMailRecord);

VAR

  objOutlook      : OutlookApplication;

  CurrentInterface : IUnknown;

  ActiveApplication : HResult;

  CurrentMailItem  : MailItem;

  MailInspector    : Inspector;

begin

  ActiveApplication:=GetActiveObject(CLASS_OutlookApplication, nil, CurrentInterface);

  if ActiveApplication = MK_E_UNAVAILABLE then

    objOutlook := CoOutlookApplication.Create

  else

  begin

    OleCheck(ActiveApplication);

    OleCheck(CurrentInterface.QueryInterface(OutlookApplication, objOutlook));

  end;

  CurrentMailItem:= objOutlook.CreateItem(0) as MailItem;

  CurrentMailItem.To_ :=MailDetail.para;

if MailDetail.anexar<>'' then

CurrentMailItem.Attachments.Add(MailDetail.Anexar,EmptyParam);

  CurrentMailItem.Cc:=MailDetail.Cc;

  CurrentMailItem.BCC:=MailDetail.BCC;

  CurrentMailItem.Subject := MailDetail.assunto;

  CurrentMailItem.Body := MailDetail.Body;

  MailInspector := CurrentMailItem.GetInspector;

  MailInspector.Display(False);

  Showmessage('Click OK quando Terminar');

  objOutlook.Quit;

  objOutlook := nil;

end;

end.

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Após o IF, insira o BEGIN, pois há mais de uma linha para ser executada... Repare que em seu 1º IF há apenas uma linha...

Espero ter ajudado...

Share this post


Link to post
Share on other sites
  • 0
Guest Guest

Infelizmente o problema não foi resolvido ele acusa que não entendeu a palavra EmptyParam ,

espero que alguém possa me ajudar ainda

grato

Share this post


Link to post
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
Answer this question...

×   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.

Sign in to follow this