Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 Dec : Re: invoke email client

www.cryer.info
Managed Newsgroup Archive

Re: invoke email client

Subject:Re: invoke email client
Posted by:"Peter" (peace39..@yahoo.com)
Date:Mon, 1 Jan 2007 22:06:49

"Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message
news:459975fd$1@newsgroups.borland.com...
>
> "Peter" <peace3977@yahoo.com> wrote in message
> news:459865b4$1@newsgroups.borland.com...
>
>> Well, I put a call to MapiSendMail in my app, it always gets an
> error
>> MAPI_E_FAILURE
>
> You are not using it correctly.  Try this code instead:
>
>    uses
>        Mapi;
>
>    procedure TfrmMain.btnEmailClick(Sender: TObject);
>    var
>        Session : LHANDLE;
>        Orig : TMapiRecipDesc;
>        Recip : PMapiRecipDesc;
>        Msg : TMapiMessage;
>        Res : Integer;
>    begin
>        ZeroMemory(@Msg, SizeOf(Msg));
>        ZeroMemory(@Orig, SizeOf(Orig));
>
>        // if you do not want to specify a MAPI profile explicitially,
> you can retreive the default one from the Registry:
>        //
>        // NT+: HKCU\Software\Microsoft\Windows
> NT\CurrentVersion\Windows Messaging Subsystem\Profiles
>        // 9x/ME: HCKU\Software\Microsoft\Windows Messaging
> Subsystem\Profiles
>        //
>        // "DefaultProfile" (REG_SZ) = "the profile name"
>
>        Res := MAPILogon(Application.Handle, 'Mapi Profile here', '',
> MAPI_LOGON_UI, 0, @Session);
>        if Res = SUCCESS_SUCCESS then
>        begin
>            Res := MAPIResolveName(Session, Application.Handle,
> 'sysadmin@pfksystems.com', 0, 0, Recip);
>            if Res = SUCCESS_SUCCESS then
>            begin
>                Recip^.ulRecipClass := MAPI_TO;
>
>                Orig.ulRecipClass := MAPI_ORIG;
>                Orig.lpszName := 'Peter';
>                Orig.lpszAddress := 'peter@pfksystems.com';
>
>                Msg.lpszSubject := 'Message subject here';
>                Msg.lpszNoteText := 'Message text here';
>                Msg.lpOriginator := @Orig;
>                Msg.nRecipCount := 1;
>                Msg.lpRecips := Recip;
>
>                Res := MapiSendMail(Session, Application.Handle, Msg,
> MAPI_LOGON_UI, 0);
>                MAPIFreeBuffer(@Recip);
>            end;
>            MAPILogoff(Session, Application.Handle, 0, 0);
>        end;
>        sb.SimpleText := 'Result: ' + IntToStr(Res);
>    end;
>
>
> Gambit
>
>

getting close now, with your sample code I can send a message, but what I
would like is a new email client send message window to appear with the to
field filled in. Instead my message is sent without a chance for user input
of text and subject.

I tried adding the MAPI_DIALOG flag to no avail.

Replies:

In response to:

www.cryer.info
Managed Newsgroup Archive