News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Opening send e-mail box

Started by dougiem, October 07, 2005, 04:42:07 AM

Previous topic - Next topic

dougiem

I am looking for a way to open my email 'Send message' box with an attachment already in place, ready for text.
I was so impressed with the WinZip (right click on explorer) extension to "Zip and E-mail" that I decided to integrate this feature into my application. I thought it was a case of ShellExecute and throw in a few commandline params. Not so.
The only parameter of use to me is "add to existing zip file". I am now able to select files from a dialog box and zip them. What I would like is some info on the mechanism to just open the send box with my zip file in place.
Thanks in advance,
dougiem


P1

Well, you have basically three choices.  CDO or MAPI or SMTP

1.  CDO is the M$ specific solution and has the 'benefit' of M$ recent changes for e-mail security.
2.  MAPI is a more primative mail interface.  But usefull, because the other e-mail clients like Groupwise supply a MAPI interface for the 'Send To' feature to work with a default OS e-mail setup.
3.  But when I do need e-mail in my MASM programs, I have coded a basic SMTP engine direct to a relaying server.  There are several examples of kind of MASM code around.  'Search' and Google are your best friends.

I personally don't have any MASM code for 1 & 2.  I use VB for that kind of stuff.

Regards,  P1  :8)

dougiem

Comrade,
   WinRar has the answer on the commandline I talked about, however, I have gone down this "winZip route" so far and I think it is something that would be usefull, plus I dont want to give in!

PI,
    i have run out of 'googles' the results are full blown mail applications and generally not in asm. The MAPI compatibility is my way forward
I am onlly wanting to open the send box which the user will then take over. I do not wat to connect or send e-mail.
any further pointers would be appreciated, thanks
dougiem

dougiem

I have at last worked it out:

; Open default empty email client with attachment.
; pFname is address of full path name of file to attach

OpenEmailAttach proc uses edi ecx pFname:dword
local funct   :dword
local MAPIfile:MapiFileDesc
local MAPImsg :MapiMessage

;note: Mapi32.dll acts as a central dispatcher for simple and extended MAPI.
;      must use load library
   invoke LoadLibrary,SADD("MAPI32.DLL")
   invoke GetProcAddress,eax,SADD("MAPISendMail")
   mov funct,eax

   lea edi,MAPIfile
   mov ecx,sizeof MapiFileDesc
   mov al,0
   rep stosb

   lea edi,MAPImsg
   mov ecx,sizeof MapiMessage
   mov al,0
   rep stosb

   m2m MAPIfile.lpszPathName,pFname ; Full path to file.
   std
   mov edi,pFname
   invoke lstrlen,edi
   add edi,eax
   mov ecx,eax
   mov al,"\"
   repne scasb
   add edi,2
   cld
   mov MAPIfile.lpszFileName,edi     ; use the filename part.
   mov MAPIfile.nPosition,0FFFFFFFFh ; position in msg not specified.

; Create a blank message MAPISendMail will let the user input data.
   mov MAPImsg.nFileCount,1
   lea eax,MAPIfile
   mov MAPImsg.lpFiles,eax

; Initiate the email.
   lea eax,MAPImsg
   Scall funct,0,0,eax,MAPI_DIALOG,0

   ret
OpenEmailAttach endp


dougiem

P1

dougiem,

Thanks for sharing your solution.  It will save others time in the future in doing the same kind of programming.

Regards,  P1  :8)