Community Discussions and Support
Problem whith mapi

Peter,

Perhaps we should continue this conversation offline - my email address is irelam@telus.net    The Mapi.dialog flag is only to access the proprietary Microsoft MSExchange and the Outlook client interface, for things such as the Mail folders and address books. To use this would require the writing of a whole email client. The best you could do is to write a POP3/IMAP4 client to fetch email from a server. Address books are in all cases proprietary/copyrite protected so accessing them programatically is next to impossible. MsExchange is a database application based on MS Sql, and needs database programming techniques.

The non-Microsoft MAPI dlls, including mine, are only intended to be used by file sending functions such as Send_To in Windows Explorer 

Perhaps you could indicate to me what you are trying to achieve, in an offline conversation, and I may be able to offer some suggestions. 

Cheers

     Martin 

<p>Peter,</p><p>Perhaps we should continue this conversation offline - my email address is irelam@telus.net    The Mapi.dialog flag is only to access the proprietary Microsoft MSExchange and the Outlook client interface, for things such as the Mail folders and address books. To use this would require the writing of a whole email client. The best you could do is to write a POP3/IMAP4 client to fetch email from a server. Address books are in all cases proprietary/copyrite protected so accessing them programatically is next to impossible. MsExchange is a database application based on MS Sql, and needs database programming techniques.</p><p>The non-Microsoft MAPI dlls, including mine, are only intended to be used by file sending functions such as Send_To in Windows Explorer </p><p>Perhaps you could indicate to me what you are trying to achieve, in an offline conversation, and I may be able to offer some suggestions. </p><p>Cheers</p><p>     Martin </p>

Friendly hallo,

I want to prepare a mail with my software and the User shall be able to edit this mail before sending. Therefore and to be independend of the mailer I use the simple mapi to prepare the mail. It works whith Outlook. But when I test it with Pegasus, Pegasus starts, but there is no Window for a new mail.

The mapipm.log looks like this:

19 November 18:37 MapiSendMail called
19 November 18:37 MAPI for Pegasus Mail 1.7.7 (October 18, 2010)
19 November 18:37 MapiSendMail: recipients supplied
19 November 18:37 PokeHeaders called
19 November 18:37 Subject line: SUBJECT: Test
19 November 18:37 Recipient starts
19 November 18:37 recipient: SMTP:mailbox@domain.de
19 November 18:37 Recipient: TO: SMTP:mailbox@domain.de
19 November 18:37 Recipients ends
19 November 18:37 Body text begins
19 November 18:37 message line: DATA: <Das ist ein Beispieltext
Er enthält mehrere Zeilen
as soll nun genug sein.
 
>
19 November 18:37 body text ends
19 November 18:37 PokeHeaders ends
19 November 18:37 No attachments given
19 November 18:37 DDE done

In a discussion I read "SUBJECT: Test" is the reason. With my software I insert only "Test" to the descriptor:

MapiMessage.lpszSubject := StrNew(PChar( Edit3.Text ));  {Edit3.Text = 'Test'}

Who kan help me to solve this problem?

Greetings

Peter

&lt;p&gt;Friendly hallo,&lt;/p&gt;&lt;p&gt;I want to prepare a mail with my software and the User shall be able to edit this mail before sending. Therefore and to be independend of the mailer I use the simple mapi to prepare the mail. &lt;b&gt;It works whith Outlook&lt;/b&gt;. But when I test it with Pegasus, Pegasus starts, but there is no Window for a new mail.&lt;/p&gt;&lt;p&gt;The mapipm.log looks like this: &lt;/p&gt;&lt;p&gt;19 November 18:37 MapiSendMail called 19 November 18:37 MAPI for Pegasus Mail 1.7.7 (October 18, 2010) 19 November 18:37 MapiSendMail: recipients supplied 19 November 18:37 PokeHeaders called 19 November 18:37 Subject line: SUBJECT: Test 19 November 18:37 Recipient starts 19 November 18:37 recipient: SMTP:mailbox@domain.de 19 November 18:37 Recipient: TO: SMTP:mailbox@domain.de 19 November 18:37 Recipients ends 19 November 18:37 Body text begins 19 November 18:37 message line: DATA: &amp;lt;Das ist ein Beispieltext Er enth&auml;lt mehrere Zeilen as soll nun genug sein. &amp;nbsp; &amp;gt; 19 November 18:37 body text ends 19 November 18:37 PokeHeaders ends 19 November 18:37 No attachments given 19 November 18:37 DDE done&lt;/p&gt;&lt;p&gt;In a discussion I read &quot;&lt;b&gt;SUBJECT: Test&lt;/b&gt;&quot; is the reason. With my software I insert only &quot;&lt;b&gt;Test&lt;/b&gt;&quot; to the descriptor:&lt;/p&gt;&lt;p&gt;MapiMessage.lpszSubject := StrNew(PChar( Edit3.Text ));&amp;nbsp; {&lt;b&gt;Edit3.Text = &#039;Test&#039;&lt;/b&gt;}&lt;/p&gt;&lt;p&gt;Who kan help me to solve this problem?&lt;/p&gt;&lt;p&gt;Greetings&lt;/p&gt;&lt;p&gt;Peter &lt;/p&gt;

As you have supplied all the components of a message, there is no need for MapiPM to invoke the Pegasus Mail editor, so the message is ready to send.  I suggest you try adding everything except the recipients. You should then get the standard Pegasus Mail editor, where you can add recipients, and anything else you want, even body text.

Martin  (author MapiPM)

 

&lt;p&gt;As you have supplied all the components of a message, there is no need for MapiPM to invoke the Pegasus Mail editor, so the message is ready to send. &amp;nbsp;I suggest you try adding everything except the recipients. You should then get the standard Pegasus Mail editor, where you can add recipients, and anything else you want, even body text.&lt;/p&gt;&lt;p&gt;Martin &amp;nbsp;(author MapiPM)&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;

Hallo Martin,

 thank you for your answer. The mail I prepared has not been send. How can I invoke the Pegasus Mail editor whith simple mapi? The lpOriginator and lpRecips is setup now.

By the way,  I tried a MapiLogOn, the result was not 0. Does mapipm support MapiLogOn and MapiLogOff?

Greetings

Peter

&lt;p&gt;Hallo Martin,&lt;/p&gt;&lt;p&gt;&amp;nbsp;thank you for your answer. The mail I prepared has not been send. How can I invoke the Pegasus Mail editor whith simple mapi? The &lt;b&gt;lpOriginator&lt;/b&gt; and &lt;b&gt;lpRecips&lt;/b&gt; is setup now.&lt;/p&gt;&lt;p&gt;By the way,&amp;nbsp; I tried a &lt;b&gt;MapiLogOn&lt;/b&gt;, the result was &lt;b&gt;not&lt;/b&gt; 0. Does mapipm support MapiLogOn and MapiLogOff? &lt;/p&gt;&lt;p&gt;Greetings&lt;/p&gt;&lt;p&gt;Peter &lt;/p&gt;

Second posting

It would be far easier for you to use something like this (Delphi but convertable to C)

Var

  tempstr: string;

begin 

   tempstr := 'mailto:'+ emailAddress + '?Subject=' + subjectText +  '&Body=' + bodyText';

  rc := ShellExecute(0,'Open',pchar(tempstr),nil,nil,sw_shownormal); (* sw_shownormal defined in Windows *)

Martin 

&lt;p&gt;Second posting&lt;/p&gt;&lt;p&gt;It would be far easier for you to use something like this (Delphi but convertable to C)&lt;/p&gt;&lt;p&gt;Var&lt;/p&gt;&lt;p&gt;&amp;nbsp; tempstr: string;&lt;/p&gt;&lt;p&gt;begin&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp;tempstr := &#039;mailto:&#039;+ emailAddress + &#039;?Subject=&#039; + subjectText +&lt;span style=&quot;font-size: 10pt;&quot;&gt;&amp;nbsp; &#039;&amp;amp;Body=&#039; + bodyText&#039;;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&lt;span style=&quot;font-size: 10pt;&quot;&gt;rc := ShellExecute(0,&#039;Open&#039;,pchar(tempstr),nil,nil,sw_shownormal);&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;&amp;nbsp;(* sw_shownormal defined in Windows *)&lt;/span&gt;&lt;/p&gt;&lt;p&gt;Martin&amp;nbsp;&lt;/p&gt;

MapiLogon and MapiLogoff are not used in Simple Mapi, they are only used in Extended Mapi, and are needed to login to MsExchange servers. So no they are not supported, and the MapiPM.log will show that they were called, but do nothing else.  Depending on what you are trying to do, you might want to try MapiSendDocuments instead, its much easier to code if all you want to do is send files to someone. As it has to prompt the user for recipents, MapiPM will invoke Pegasus Mail automatically.

Martin 

 

&lt;p&gt;MapiLogon and MapiLogoff are not used in Simple Mapi, they are only used in Extended Mapi, and are needed to login to MsExchange servers. So no they are not supported, and the MapiPM.log will show that they were called, but do nothing else. &amp;nbsp;Depending on what you are trying to do, you might want to try MapiSendDocuments instead, its much easier to code if all you want to do is send files to someone. As it has to prompt the user for recipents, MapiPM will invoke Pegasus Mail automatically.&lt;/p&gt;&lt;p&gt;Martin&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;

Hallo Martin,

thank you again! Up to now I use the ShellExecute - command. But I do not add the mail-body, because I read somewhere, the lenth of text is limited. And I hoped, I can support several mail applications using the mapi.

Greetings

Peter

 

&lt;p&gt;Hallo Martin,&lt;/p&gt;&lt;p&gt;thank you again! Up to now I use the &lt;span style=&quot;font-size:10pt;&quot;&gt;ShellExecute - command. But I do not add the mail-body, because I read somewhere, &lt;/span&gt;the lenth of text is limited. And I hoped, I can support several mail applications using the mapi.&lt;/p&gt;&lt;p&gt;Greetings&lt;/p&gt;Peter &lt;p&gt;&amp;nbsp;&lt;/p&gt;

If you want to simply invoke Pegasus Mail from your program, I suggest you just use MapiSendDocuments, with Nil for the filename, ie:

 TMAPISendDocuments = function(UIParam: cardinal; DelimChar: pchar;  FilePaths: pchar; FileNames: pchar;  Reserved: cardinal): cardinal; stdcall;

mapisenddocuments: tmapisenddocuments;

hlib := loadlibrary('c:\pmail\mapipm.dll'); 

@mapisenddocuments := getprocaddress(hlib,'MAPISENDDOCUMENTS'); 

 mapisenddocuments(0,nil,nil,nil,0);  Which will open up Pegasus Mail message compose screen 

freelibrary(hlib); 

&lt;p&gt;If you want to simply invoke Pegasus Mail from your program, I suggest you just use MapiSendDocuments, with Nil for the filename, ie:&lt;/p&gt;&lt;p&gt;&amp;nbsp;TMAPISendDocuments = function(UIParam: cardinal; DelimChar: pchar;&lt;span style=&quot;font-size: 10pt;&quot;&gt;&amp;nbsp; FilePaths: pchar; FileNames: pchar;&lt;/span&gt;&lt;span style=&quot;font-size: 10pt;&quot;&gt;&amp;nbsp; Reserved: cardinal): cardinal; stdcall;&lt;/span&gt;&lt;/p&gt;&lt;div&gt;mapisenddocuments: tmapisenddocuments;&lt;/div&gt;&lt;p&gt;hlib := loadlibrary(&#039;c:\pmail\mapipm.dll&#039;);&amp;nbsp;&lt;/p&gt;&lt;p&gt;@mapisenddocuments := getprocaddress(hlib,&#039;MAPISENDDOCUMENTS&#039;);&amp;nbsp; &lt;/p&gt;&lt;p&gt;&amp;nbsp;mapisenddocuments(0,nil,nil,nil,0); &amp;nbsp;Which will open up Pegasus Mail message compose screen&amp;nbsp;&lt;/p&gt;&lt;p&gt;freelibrary(hlib);&amp;nbsp;&lt;/p&gt;

Hallo Martin,

thank you again! After a lot of tests my result is:

 What I want to do is not possible, because an important part of mapi is not implemented with Pegasus.
  The flag "MAPI_DIALOG" is ignored by Pegasus. This flag controls to show the new mail window or send the mail 'silent'.

 "MAPISendDocuments" opens the mail edit window, but there is no Mailadress no Subjekt and no message.

 If I use the "-J" start option, the mail is send 'silent'. No chance to add, remove or change parts of the mail.

 "ShellExecute" can only insert very view text.

So the only thing I can do is create a window that looks like the Pegasus new mail window and send the mail quiet after editing.[:^)]

Greetings

Peter

 

&lt;p&gt;Hallo Martin,&lt;/p&gt;&lt;p&gt;thank you again! After a lot of tests my result is:&lt;/p&gt;&lt;p&gt;&amp;nbsp;What I want to do is not possible, because an important part of mapi is not implemented with Pegasus. &amp;nbsp; The flag &quot;&lt;b&gt;MAPI_DIALOG&lt;/b&gt;&quot; is ignored by Pegasus. This flag controls to show the new mail window or send the mail &#039;silent&#039;. &lt;/p&gt;&lt;p&gt;&amp;nbsp;&quot;&lt;b&gt;MAPISendDocuments&lt;/b&gt;&quot; opens the mail edit window, but there is no Mailadress no Subjekt and no message.&lt;/p&gt;&lt;p&gt;&amp;nbsp;If I use the &quot;&lt;b&gt;-J&lt;/b&gt;&quot; start option, the mail is send &#039;silent&#039;. No chance to add, remove or change parts of the mail.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&quot;&lt;b&gt;ShellExecute&lt;/b&gt;&quot; can only insert very view text.&lt;/p&gt;&lt;p&gt;So the only thing I can do is create a window that looks like the Pegasus new mail window and send the mail quiet after editing.[:^)]&lt;/p&gt;&lt;p&gt;Greetings&lt;/p&gt;Peter &lt;p&gt;&amp;nbsp;&lt;/p&gt;
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
With selected deselect posts show selected posts
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft