Sign up on the Revelation Software website to have access to the most current content, and to be able to ask questions and get answers from the Revelation community

MAPISendMail Multifiles (OpenInsight 32-bit Specific)

At 09 FEB 2011 01:34:28AM Barry Stevens wrote:

First time (I think) I have had to send multiple attachments in an email. Works with 1 file try 2 files get messages that file cant be found. Tried to decipher the meaning of the POS_POSITIONS$ field to see if it is related to multi files, but don't understand it. Running 9.2.1 - I am assuming not beta bug.

Is the following correct:

Message='

Message=Subject

Message=Email

Message=TxtBodys

Message=IPM."

Message=Doc1 test.PDF":@vm:"Doc2 test.PDF"

Message=C:\EMAILPDF\Doc1 test.PDF":@vm:"C:\EMAILPDF\Doc2 test.PDF"

Message=( len( message) - 2 )

if MAPISendMail(0, 0, Flags, Message) then


At 10 FEB 2011 08:10AM Dave Harmacek wrote:

Check out and consider the S/SMTP offer from Sprezzatura, http://www.sprezzatura.com, see the Announcements for links and documentation.

Dave


At 10 FEB 2011 09:09AM [url=http://www.sprezzatura.com]The Sprezzatura Group[/url] wrote:

Thanks Dave - hopefully one of those cases where what is delivered is not worth what you pay for it given it's free :).

The Sprezzatura Group

The Sprezzatura Blog

World leaders in all things RevSoft


At 10 FEB 2011 03:25PM Barry Stevens wrote:

It is not shown on your site anymore, also, the other utils that are shown have no 'more' links.


At 10 FEB 2011 08:24PM Dave Harmacek wrote:

When I go to their site, on the right is an Announcements section which reads:

15th October 2010

We're pleased to announce the release of version 1.2.1 of S/SMTP, our freeware SMTP client for OpenInsight, which you can find here. This version fixes a bug when connecting to a mail server over SSL.

More details on S/SMTP can be found in this blog post.

If I click on the "here" it offers to download a .zip file.

http://www.sprezzatura.com/downloads/products/zz_smtp/latest/zzxSMTP%20Object%20Code%20-%20Full%20Version%201.2.1.zip

Dave


At 10 FEB 2011 09:19PM Barry Stevens wrote:

Ahhh, that was sneaky, thanks


At 13 FEB 2011 12:04AM Barry Stevens wrote:

Can anyone tell me if the following is correct:

Message='

Message=Subject

Message=Email

Message=TxtBodys

Message=IPM."

Message=Doc1 test.PDF":@vm:"Doc2 test.PDF"

Message=C:\EMAILPDF\Doc1 test.PDF":@vm:"C:\EMAILPDF\Doc2 test.PDF"

Message=( len( message) - 2 )

What about Message , whare the help says it is @vm delimited - is that related to @vm file list.


At 13 FEB 2011 01:05AM Barry Stevens wrote:

Here is what I am testing with..this code returns error mapi 11 attachment not found. If the lines:

FullFileNames=C:\EMAILOUTS\JobQuoteDetails809A.PDF"

FullFileNames=C:\EMAILOUTS\JobQuoteDetails809.PDF"

are commented out, email is sent.

*

function test_mapisendmail(Void)

*

*Returns 1 if error

*

declare subroutine Msg, Get_Status

declare function   MapiSendMail, MAPILogon, MAPILogoff, Unassigned, Dialog_Box
$insert Mapi_Equates
equ CRLF$	to 	\0D0A\
equ CR$   to 	\0D\
equ LF$   to 	\0A\
equ TAB$  to 	\09\
equ	null$	To	''
  • Session="

* Flags=MAPI_LOGON_UI$

* x=Set_Status(0)

* check=MAPILogon(session, @window, , , flags)

* if Get_Status(ErrCode) then

* Call FsMsg()

* end

[email protected]"
FullFileNames=null$
FullFileNames=C:\EMAILOUTS\JobQuoteDetails809B.PDF"
FullFileNames=C:\EMAILOUTS\JobQuoteDetails809A.PDF"
FullFileNames=C:\EMAILOUTS\JobQuoteDetails809.PDF"
FileNames=null$
cnt=Count(FullFileNames,@vm) + (FullFileNamesnull$)
For x=1 To cnt
	FileNames=FullFileNames-1,'B\'
Next x
TxtBody=This is one line"
Company=TESTING COMPANY"
Subject=TESTING SUBJECT"
Message='
Message=Subject
Message=Email
Message=TxtBody
Message='
Content_Type= "IPM."
Message=Content_Type
Message=FileNames
Message=FullFileNames
Message=( len( message) - 2 ) 
RetVal=0
x=Set_Status(0)
if MAPISendMail('','','', Message) then
  Msg(@window, "Email to ":Company:" sent successfully!":@fm:"T1")
end else
  Get_Status(ErrMsg)
  Msg(@window, "Email to ":Company:"!":ErrMsg)
	RetVal=1
end

Return RetVal

***


At 16 FEB 2011 01:39PM Barry Stevens wrote:

Is anyone able to give me an answer on this. I have sprezz util working, now user needs a return receipt.

Can you or cant you sent multiple attachments using MAPISendmail.


At 16 FEB 2011 07:00PM [email protected] wrote:

Barry,

If you're using our SMTP library you should have the source to one of the smtp_Sendxxxx functions:

  • smtp_SendText
  • smtp_SendHTML

If you look in there you'll see a message being built using smtp_Set_Property to set the MSG property…

e.g.

   
   ...
   
   objxArray := @rm : smtpID
   propArray := @rm : "MSG.FROM" 
   dataArray := @rm : sender
      
   if len( replyTo ) then
      objxArray := @rm : smtpID
      propArray := @rm : "MSG.REPLYTO"
      dataArray := @rm : replyTo
   end
      
   objxArray := @rm : smtpID
   propArray := @rm : "MSG.TO"
   dataArray := @rm : toList
   
   ...
   
   call smtp_Set_Property( objxArray, propArray, dataArray )
      

All you need to do is:

  1. Take a copy of the function
  2. Rename it to something like BS_SMTP_SendHTML()
  3. Add an extra argument to pass in the receipt-to address
  4. Add an extra statement to set the MSG.RECEIPTTO property like so:
   
   ...
   
   objxArray := @rm : smtpID
   propArray := @rm : "MSG.FROM" 
   dataArray := @rm : sender
      
   if len( replyTo ) then
      objxArray := @rm : smtpID
      propArray := @rm : "MSG.REPLYTO"
      dataArray := @rm : replyTo
   end
      
   objxArray := @rm : smtpID
   propArray := @rm : "MSG.TO"
   dataArray := @rm : toList
   
   * // Request a read-receipt - set the MSG.RECEIPTTO
   * // property to the address the receipt should be 
   * // sent to ... 
   * // 
   * // e.g     [email protected]"
   
   objxArray := @rm : smtpID
   propArray := @rm : "MSG.RECEIPTTO"
   dataArray := @rm : receiptTo
   
   ...
   
   call smtp_Set_Property( objxArray, propArray, dataArray )
      

[email protected]

Captain's Blog

Battlestar Sprezzatura - BSG 77

Colonial leaders in all things RevSoft


At 16 FEB 2011 07:09PM [email protected] wrote:

Barry,

To answer your other question you should be able to send multiple files via MAPI. Can't say we've used this in a long time but here's a snippet of code from one of our MAPI email programs that worked:

   ...
   
   * // NOTE: dataArray contains the MAPI message to send
   
   * // And set the position at the end of the message
               
   noOfAttachments = count( emailAttachments, @vm ) + 1
   for x = 1 to noOfAttachments
      emailMessage := " "
      dataArray<POS_POSITIONS$,x> = len( emailMessage ) - 1
               
      * // Make sure the path is fully qualified
               
      dataArray<POS_PATHS$,x> = zzx_Utility( "RESOLVEPATH", dataArray<POS_PATHS$,x>, "" )
   next
               
   dataArray<POS_TEXT$> = emailMessage
            
   * // Note the path to any attachments MUST be fully qualified - 
   * // it cannot be relative!!!!
   
   ...
   

[email protected]

Captain's Blog

Battlestar Sprezzatura - BSG 77

Colonial leaders in all things RevSoft


At 17 FEB 2011 02:23PM Barry Stevens wrote:

]]dataArray=len( emailMessage ) - 1

Thank you, I thought that was the culprit…thank you ever so much.


At 17 FEB 2011 02:24PM Barry Stevens wrote:

Wow that looks fun, I shall definitely try that and implement.


At 17 FEB 2011 03:26PM Barry Stevens wrote:

Cool, works….I just used the sender.

View this thread on the forum...