[vwnc] Default mailer

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[vwnc] Default mailer

Annick
On Windows, is it possible to open the default mail application in the  
same way that ExternalBrowser opens the default browser ?
Namely we don't know the smtp server locally, so program-based mail  
sending is difficult.
Clicking on a mailto:[hidden email] hyperlink works but no  
attachment is possible.

        Annick Fron

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] Default mailer

Mark Pirogovsky-3
Depending how your system is set you can use SimpleMApi protocols.  Our
application does use it to send attachments.  And it works on about 80%
of installations.  Here is what you need to do:

Define class like:


Smalltalk.OS defineClass: #MinimalMAPIIntrface
    superclass: #{OS.Win32SystemSupport}
 ())
            #(#libraryFiles #('mapi32.dll'))
            #(#libraryDirectories #())
            #(#beVirtual false)
            #(#optimizationLevel #full))

create method:
MAPISendDocuments:wHandle delmiter:aCharacter fullPaths: aFulPathStr
fileNames:fileNamesStr reserved:aNumber
    <C: ulong _threaded _wincall MAPISendDocuments(HWND wHandle, LPSTR
aCharacter, LPSTR aFulPathStr,  LPSTR fileNamesStr, UINT aNumber    
)>
    ^self externalAccessFailedWith: _errorCode

and send emails as following method suggests:

mailFiles: aFileNamesCollection forWindow: aWindow
    "self mailFiles: #('e:\Error.avi'  ) forWindow:Dialog
defaultParentWindow"

    | aDelimiter aFulPathStr fileNamesStr aF aP res xif |
    self shiftHalt.
    aDelimiter := ';'.
    aFulPathStr := String new.
    fileNamesStr := String new.
    aFileNamesCollection do:
            [:ea |
            (aF := Filename named: ea) exists
                ifTrue:
                    [aFulPathStr := aFulPathStr , aF asString , aDelimiter.
                    fileNamesStr := fileNamesStr , aF tail asString ,
aDelimiter]].
    fileNamesStr size > 1 ifFalse: [^nil].
    aFulPathStr at: aFulPathStr size put: Character space.
    fileNamesStr at: fileNamesStr size put: Character space.
    aDelimiter := aDelimiter trimBlanks gcCopyToHeap.
    aFulPathStr := aFulPathStr trimBlanks gcCopyToHeap.
    fileNamesStr := fileNamesStr trimBlanks gcCopyToHeap.
    xif := self new.
    aP :=
            [
            [res :=
                    [xif
                        MAPISendDocuments: aWindow windowHandle
                        delmiter: aDelimiter
                        fullPaths: aFulPathStr
                        fileNames: fileNamesStr
                        reserved: 0]
                            on: Error
                            do:
                                [:ex |
                                ex parameter ifNotNil:
                                        [:par |
                                        par errorCode = 0 ifFalse:
[Dialog warn: ex messageText].
                                        ex return: nil]]]
                    ensure: [Filename defaultDirectory beCurrentDirectory]]
                    newProcess.
    aP resume.
    ^aP -> res

Annick Fron wrote:

> On Windows, is it possible to open the default mail application in the  
> same way that ExternalBrowser opens the default browser ?
> Namely we don't know the smtp server locally, so program-based mail  
> sending is difficult.
> Clicking on a mailto:[hidden email] hyperlink works but no  
> attachment is possible.
>
> Annick Fron
>
> _______________________________________________
> vwnc mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>
>
>
>  

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc