Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.clipper.visual-objects > #8010 > unrolled thread

Sending RTF email via MAPI

Started byAndrew Dunn <andrewdunn50@gmail.com>
First post2015-04-28 18:23 -0700
Last post2015-05-10 15:29 -0700
Articles 6 — 4 participants

Back to article view | Back to comp.lang.clipper.visual-objects


Contents

  Sending RTF email via MAPI Andrew Dunn <andrewdunn50@gmail.com> - 2015-04-28 18:23 -0700
    Re: Sending RTF email via MAPI D.J.W. van Kooten <vankooten@removethis.ic2.com> - 2015-04-29 11:16 +0200
      Re: Sending RTF email via MAPI James Martin <james@northwoodlumber.com> - 2015-04-29 08:08 -0400
        Re: Sending RTF email via MAPI D.J.W. van Kooten <vankooten@removethis.ic2.com> - 2015-04-29 19:56 +0200
    Re: Sending RTF email via MAPI "Arne Ortlinghaus" <Arne.Ortlinghaus@acs.it> - 2015-05-05 08:29 +0200
    Re: Sending RTF email via MAPI Andrew Dunn <andrewdunn50@gmail.com> - 2015-05-10 15:29 -0700

#8010 — Sending RTF email via MAPI

FromAndrew Dunn <andrewdunn50@gmail.com>
Date2015-04-28 18:23 -0700
SubjectSending RTF email via MAPI
Message-ID<e70c03b4-e7e9-4e71-8f67-9b90bb075ea0@googlegroups.com>
Hi,

I'm trying to send an RTF email via MAPI - does anyone have an example?

Andrew

[toc] | [next] | [standalone]


#8011

FromD.J.W. van Kooten <vankooten@removethis.ic2.com>
Date2015-04-29 11:16 +0200
Message-ID<7881kahfc3a9bjuss2fuvlqao8tgdbnf47@4ax.com>
In reply to#8010
On Tue, 28 Apr 2015 18:23:11 -0700 (PDT), Andrew Dunn
<andrewdunn50@gmail.com> wrote:

Hello Andrew,

Marc Verkade had one years ago, this is how I have it in my library
with some modifications.

Dick

FUNCTION SendMailMapi(cSubject,cText,aFiles,aEmail) AS LOGIC
//#s Send e-mail using standard API (Marti) 20-11-2002


/*
This is a function to send email with Mapi
The sample is provided 'As it is' and is free of any copyrights.

For information or comments email to: cavo@marti.nl
This and other samples can be found at www.marti.nl/cavo

Regards,
Marc Verkade
Marti BV - Naaldwijk - Netherlands

Usage:
Cut and Paste this functions in your App
Change Vars cSubject,cText,cFile,aEmailAdresses
Call function SendMailMapi() from anywhere within your program

You can change the function and add some parameters for it!

Revision Info:
01-05-2001  Initial creation of sample
            Mapi mail routines extracted from MC_Lib for VO

*/

LOCAL nSession              AS DWORD
LOCAL nResult               AS DWORD
LOCAL lRetVal               AS LOGIC
LOCAL n                     AS DWORD
LOCAL nRecips               AS DWORD
LOCAL nFiles                AS DWORD

//  MAPI structures,  see Win32 API for structure info.
LOCAL sMessage              AS MAPIMessage
LOCAL DIM aRecip[100]       IS MAPIRecipDesc
LOCAL DIM aFile[100]        IS MAPIFileDesc

    // Init vars
    lRetVal:=TRUE

    nRecips := ALen( aEmail )
    nFiles  := ALen( aFiles )

    IF nRecips > 100     // "Too many recipients."
        lRetVal:=FALSE
    ELSEIF nFiles > 100  // "Too many files."
        lRetVal:=FALSE
    ENDIF

    // Start Mapi
    IF lRetVal
        nResult := MAPILogon( 0, NULL_PTR, NULL_PTR, MAPI_LOGON_UI,
0,@nSession )
        IF nResult <> SUCCESS
            lRetVal:=FALSE
        ENDIF

        IF lRetVal
            // Receipients
            FOR n := 1 UPTO nRecips
                aRecip[n].ulReserved    := 0
                aRecip[n].ulRecipClass  := MAPI_TO
                aRecip[n].lpszName      := PSZ(_CAST, StringAlloc(
aEmail[n] ) )
                aRecip[n].lpszAddress   := PSZ(_CAST, StringAlloc(
aEmail[n] ) )
*                aRecip[n].lpszAddress   := PSZ(_CAST, StringAlloc(
"SMTP:"+aEmail[n] ) )
// CONFIGURATIESCHERM: POSTVAK, profielen
                aRecip[n].ulEIDSize     := 0
                aRecip[n].lpEntryID     := NULL_PTR
            NEXT
            // Files
            FOR n := 1 UPTO nFiles
                aFile[n].ulReserved     :=0
                aFile[n].flFlags        :=0
                aFile[n].nPosition      :=0xFFFFFFFF
                aFile[n].lpszPathName   :=PSZ(_CAST, StringAlloc(
aFiles[n] ) )
                aFile[n].lpszFileName   :=NULL_PSZ
                aFile[n].lpFileType     :=NULL_PSZ
            NEXT

            sMessage                    :=MemAlloc( _SIZEOF(
MAPIMessage ) )
            sMessage.ulReserved         :=0
            sMessage.lpszSubject        :=PSZ(_CAST,
StringAlloc(cSubject))
            sMessage.lpszNoteText       :=PSZ(_CAST,
StringAlloc(cText))
            sMessage.lpszMessageType    :=NULL_PSZ
            sMessage.lpszDateReceived   :=NULL_PSZ
            sMessage.lpszConversationID :=NULL_PSZ
            sMessage.flFlags            :=0
            sMessage.lpOriginator       :=NULL_PTR
            sMessage.nRecipCount        :=nRecips
            sMessage.lpRecips           :=@aRecip
            sMessage.nFileCount         :=nFiles
            sMessage.lpFiles            :=@aFile

            // Send it
            lRetVal:=MAPISendMail( nSession, 0, sMessage, MAPI_DIALOG,
0 )=SUCCESS

            // Clear mem
            MemFree( sMessage.lpszSubject )
            MemFree( sMessage )
            FOR n := 1 UPTO nRecips
                MemFree( aRecip[n].lpszName )
                MemFree( aRecip[n].lpszAddress )
            NEXT
            FOR n := 1 UPTO nFiles
                MemFree( aFile[n].lpszPathName )
            NEXT
            // Logoff
            MAPILogoff( nSession , 0 , 0 , 0 )

            IF lRetVal
            ELSE
                Warningbox{,Vt(MSG_EMAILMESSAGE,"Email
message"),Vt(MSG_EMAILNOTSENT,"Email not sent")}:show()
            ENDIF
        END
    END
	RestoreDefaultPath("")
RETURN lRetVal

[toc] | [prev] | [next] | [standalone]


#8012

FromJames Martin <james@northwoodlumber.com>
Date2015-04-29 08:08 -0400
Message-ID<mhqh7h$ou2$1@dont-email.me>
In reply to#8011
I have this in my repo too, but never used it, because I didn't know 
where to put in the login info.

James

On 15-04-29 05:16 AM, D.J.W. van Kooten wrote:
> On Tue, 28 Apr 2015 18:23:11 -0700 (PDT), Andrew Dunn
> <andrewdunn50@gmail.com> wrote:
>
> Hello Andrew,
>
> Marc Verkade had one years ago, this is how I have it in my library
> with some modifications.
>
> Dick
>
> FUNCTION SendMailMapi(cSubject,cText,aFiles,aEmail) AS LOGIC
> //#s Send e-mail using standard API (Marti) 20-11-2002
>
>
> /*
> This is a function to send email with Mapi
> The sample is provided 'As it is' and is free of any copyrights.
>
> For information or comments email to: cavo@marti.nl
> This and other samples can be found at www.marti.nl/cavo
>
> Regards,
> Marc Verkade
> Marti BV - Naaldwijk - Netherlands
>
> Usage:
> Cut and Paste this functions in your App
> Change Vars cSubject,cText,cFile,aEmailAdresses
> Call function SendMailMapi() from anywhere within your program
>
> You can change the function and add some parameters for it!
>
> Revision Info:
> 01-05-2001  Initial creation of sample
>              Mapi mail routines extracted from MC_Lib for VO
>
> */
>
> LOCAL nSession              AS DWORD
> LOCAL nResult               AS DWORD
> LOCAL lRetVal               AS LOGIC
> LOCAL n                     AS DWORD
> LOCAL nRecips               AS DWORD
> LOCAL nFiles                AS DWORD
>
> //  MAPI structures,  see Win32 API for structure info.
> LOCAL sMessage              AS MAPIMessage
> LOCAL DIM aRecip[100]       IS MAPIRecipDesc
> LOCAL DIM aFile[100]        IS MAPIFileDesc
>
>      // Init vars
>      lRetVal:=TRUE
>
>      nRecips := ALen( aEmail )
>      nFiles  := ALen( aFiles )
>
>      IF nRecips > 100     // "Too many recipients."
>          lRetVal:=FALSE
>      ELSEIF nFiles > 100  // "Too many files."
>          lRetVal:=FALSE
>      ENDIF
>
>      // Start Mapi
>      IF lRetVal
>          nResult := MAPILogon( 0, NULL_PTR, NULL_PTR, MAPI_LOGON_UI,
> 0,@nSession )
>          IF nResult <> SUCCESS
>              lRetVal:=FALSE
>          ENDIF
>
>          IF lRetVal
>              // Receipients
>              FOR n := 1 UPTO nRecips
>                  aRecip[n].ulReserved    := 0
>                  aRecip[n].ulRecipClass  := MAPI_TO
>                  aRecip[n].lpszName      := PSZ(_CAST, StringAlloc(
> aEmail[n] ) )
>                  aRecip[n].lpszAddress   := PSZ(_CAST, StringAlloc(
> aEmail[n] ) )
> *                aRecip[n].lpszAddress   := PSZ(_CAST, StringAlloc(
> "SMTP:"+aEmail[n] ) )
> // CONFIGURATIESCHERM: POSTVAK, profielen
>                  aRecip[n].ulEIDSize     := 0
>                  aRecip[n].lpEntryID     := NULL_PTR
>              NEXT
>              // Files
>              FOR n := 1 UPTO nFiles
>                  aFile[n].ulReserved     :=0
>                  aFile[n].flFlags        :=0
>                  aFile[n].nPosition      :=0xFFFFFFFF
>                  aFile[n].lpszPathName   :=PSZ(_CAST, StringAlloc(
> aFiles[n] ) )
>                  aFile[n].lpszFileName   :=NULL_PSZ
>                  aFile[n].lpFileType     :=NULL_PSZ
>              NEXT
>
>              sMessage                    :=MemAlloc( _SIZEOF(
> MAPIMessage ) )
>              sMessage.ulReserved         :=0
>              sMessage.lpszSubject        :=PSZ(_CAST,
> StringAlloc(cSubject))
>              sMessage.lpszNoteText       :=PSZ(_CAST,
> StringAlloc(cText))
>              sMessage.lpszMessageType    :=NULL_PSZ
>              sMessage.lpszDateReceived   :=NULL_PSZ
>              sMessage.lpszConversationID :=NULL_PSZ
>              sMessage.flFlags            :=0
>              sMessage.lpOriginator       :=NULL_PTR
>              sMessage.nRecipCount        :=nRecips
>              sMessage.lpRecips           :=@aRecip
>              sMessage.nFileCount         :=nFiles
>              sMessage.lpFiles            :=@aFile
>
>              // Send it
>              lRetVal:=MAPISendMail( nSession, 0, sMessage, MAPI_DIALOG,
> 0 )=SUCCESS
>
>              // Clear mem
>              MemFree( sMessage.lpszSubject )
>              MemFree( sMessage )
>              FOR n := 1 UPTO nRecips
>                  MemFree( aRecip[n].lpszName )
>                  MemFree( aRecip[n].lpszAddress )
>              NEXT
>              FOR n := 1 UPTO nFiles
>                  MemFree( aFile[n].lpszPathName )
>              NEXT
>              // Logoff
>              MAPILogoff( nSession , 0 , 0 , 0 )
>
>              IF lRetVal
>              ELSE
>                  Warningbox{,Vt(MSG_EMAILMESSAGE,"Email
> message"),Vt(MSG_EMAILNOTSENT,"Email not sent")}:show()
>              ENDIF
>          END
>      END
> 	RestoreDefaultPath("")
> RETURN lRetVal
>

[toc] | [prev] | [next] | [standalone]


#8018

FromD.J.W. van Kooten <vankooten@removethis.ic2.com>
Date2015-04-29 19:56 +0200
Message-ID<ao62kaha45vnai8h2d63vn6u3ebfbdr07t@4ax.com>
In reply to#8012
On Wed, 29 Apr 2015 08:08:49 -0400, James Martin
<james@northwoodlumber.com> wrote:

Hello James,

>I have this in my repo too, but never used it, because I didn't know 
>where to put in the login info.
>
It uses your mailprogram and it's settings. I used it around 2002 and
it created the mails in Eudora.

If you want to send mails including settings straight from VO, go to
C:\cavo29\Samples\Email. 

Dick

[toc] | [prev] | [next] | [standalone]


#8039

From"Arne Ortlinghaus" <Arne.Ortlinghaus@acs.it>
Date2015-05-05 08:29 +0200
Message-ID<mi9nuc$93j$1@dont-email.me>
In reply to#8010
Sending emails with RTF bodies normally is not possible because only HTML 
bodies exist. It is necessary to convert the RTF to HTML which is not an 
easy task.

Arne Ortlinghaus
ACS Data Systems 

[toc] | [prev] | [next] | [standalone]


#8073

FromAndrew Dunn <andrewdunn50@gmail.com>
Date2015-05-10 15:29 -0700
Message-ID<61e606df-a3ae-41f3-9275-2c95d6b4630e@googlegroups.com>
In reply to#8010
On Wednesday, April 29, 2015 at 11:23:12 AM UTC+10, Andrew Dunn wrote:
> Hi,
> 
> I'm trying to send an RTF email via MAPI - does anyone have an example?
> 
> Andrew

Great thanks guys.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.clipper.visual-objects


csiph-web