Hi all,
perhaps one of you has this requeriment too. An application needs to prepare an email with some pre-defined content that depends on how do you use this app. Let's say that some customer wants email you a request from the application. I managed to solve this in a beauty simply way using an html report with a mailto: link that automatically preparates an email with that report. So where is the problem you say? The problem is when you try to use this in win 9x platforms. This works fine on win2K/XP but win9x not even hit on the error message. So I've been investigating other ways to acomplish this, one way is using the mailto call directly, so the code looks into the registry to find out how the mailto: has to be passed: HKEY_CLASSES_ROOT\mailto\shell\open\command There for instance you could find this: fileString := '"C:\ARCHIV~3\MICROS~3\Office10\OUTLOOK.EXE" -c IPM.Note /m "%1"' Where offcourse you may pass a mailto sentence like this: mailtoString := 'mailto:[hidden email]?subject=[Request] To Provider CO&body=Mr. Provider,%0d%0a%0d%0a%09My company request you the following articles from your stock...' Note that the carridge return line feed must be %0d%0a and so on... I've started to invoke this 'programatic email' calling from the ShellLibrary ShellLibrary default shellOpen: fileString directory parameters: mailtoString It didn't work Then from the KernelLibrary KernelLibrary default winExec: command (where command is the mailtoString inserted in place of %1) It also didn't work The e-mail get truncated at some point, actually the mailtoString cannot be much bigger than a size of 800, lets say 840 don't fit, wich it is obviusly a sad limitation. Well, actually I'm trying to find some other way to invoke the mail client program with a mailto parameter. This time I'm trying to call the program in it's new fashion, like M$ say, through the function createProcess of the kernel library. I found hard to know by now why it allways tells that there is an invalid handle with this code: si := STARTUPINFO new . KernelLibrary default getStartupInfo: si. pi := PROCESS_INFORMATION new. result := KernelLibrary default createProcess: <full exe file name> lpCommandLine: <parameters> lpProcessAttributes: nil lpThreadAttributes: nil bInheritsHandles: false dwCreationFlags: nil lpEnvironment: nil lpCurrentDirectory: nil lpStartupInfo: si lpProcessInformation: pi yourAddress. result KernelLibrary default closeHandle: pi yourAddress. KernelLibrary default getLastError I try to make an easy call like notepad, for instance, with no parameters but I'm not able to make it yet. any pointer to solve this are welcome to this lot soul :P best regards, Seb |
Seb,
Attachments, aside, email is quite easy to prepare and send. Squeak/Celeste appears to handle attachments too, though I've never done more than poke at it. IMHO, you will get a lot more bang from your time spending it on porting some Squeak code to Dolphin than you will on working around the quirks of MS binaries on Win9x. Just preaching what I practice :) Have a good one, Bill -- Wilhelm K. Schwab, Ph.D. [hidden email] |
In reply to this post by Smalltalkiano-4
Seb,
"Smalltalkiano" <[hidden email]> wrote in message news:b99cch$gi5s7$[hidden email]... [...] > The problem is when you try to use this in win 9x platforms. This works > fine on win2K/XP but win9x not even hit on the error message. I wonder whether this is a problem with command-line length limits? Old DOS used to have a limit of 127 or 128 characters; XP supposedly has a limit of around 8K. [...] > ShellLibrary > ShellLibrary default shellOpen: fileString directory parameters: > mailtoString > > It didn't work I wonder whether it might work better to invoke the mail-to URL directly, instead of passing it as a command-line argument. Try passing just the mailtoString to #shellOpen:. HTH, Don [...] > best regards, > > Seb > > > > > > > > > |
"Don Rylander" <[hidden email]> escribió en el
mensaje news:b9b8pp$hjmhn$[hidden email]... > Seb, > "Smalltalkiano" <[hidden email]> wrote in message > news:b99cch$gi5s7$[hidden email]... > [...] > > The problem is when you try to use this in win 9x platforms. This > works > > fine on win2K/XP but win9x not even hit on the error message. > I wonder whether this is a problem with command-line length limits? Old DOS > used to have a limit of 127 or 128 characters; XP supposedly has a limit of > around 8K. As I've been reading over there, that is what's happening. > > [...] > > ShellLibrary > > ShellLibrary default shellOpen: fileString directory parameters: > > mailtoString > > > > It didn't work > I wonder whether it might work better to invoke the mail-to URL directly, > instead of passing it as a command-line argument. Try passing just the > mailtoString to #shellOpen:. Well I've tried your suggestion with the same results (mail body contents truncated near 800 characters). But what you say here simplifies considerably the mail client invocation. regards, Seb > > HTH, > > Don > > [...] > > best regards, > > > > Seb > > > > > > > > > > > > > > > > > > > > |
In reply to this post by Don Rylander-3
Seb,
It looks like my earlier suggestion suffers from similar limitations, so try this link: http://www.smalltalking.net/Goodies/Dolphin/ Scroll down to the POP & SMTP Sockets goodie, where you'll find a port of some of the Squeak code the Bill mentioned (with the advantage of already being done!). It seems to work pretty well in the simple case, although I haven't done more than play with it. Thanks are due to Jose Calvo for the effort. HTH, Don |
In reply to this post by Bill Schwab-2
Bill,
I'm considering this because I have not too much options, regards, Seb "Bill Schwab" <[hidden email]> escribió en el mensaje news:b99oit$gus5f$[hidden email]... > Seb, > > Attachments, aside, email is quite easy to prepare and send. Squeak/Celeste > appears to handle attachments too, though I've never done more than poke at > it. IMHO, you will get a lot more bang from your time spending it on > porting some Squeak code to Dolphin than you will on working around the > quirks of MS binaries on Win9x. > > Just preaching what I practice :) > > Have a good one, > > Bill > > -- > Wilhelm K. Schwab, Ph.D. > [hidden email] > > > > |
In reply to this post by Don Rylander-3
Dear Don,
I'm right now testing the code that you mention. This package, seems to be useful taking the 'hard path' of programatically sending an email. For usual smtp it is already fuctional, I only need to add the smtp authentication requeriment in some sort of SMTPAuthenticatedSocket that I'm trying to implement. It's no so trivial because of the authentication protocol. I'm studying the RFC 2045 and 2554 to know details to authenticate and prepare the email. regards, Seb "Don Rylander" <[hidden email]> escribió en el mensaje news:b9bang$hcrjj$[hidden email]... > Seb, > > It looks like my earlier suggestion suffers from similar limitations, so try > this link: > > http://www.smalltalking.net/Goodies/Dolphin/ > > Scroll down to the POP & SMTP Sockets goodie, where you'll find a port of > some of the Squeak code the Bill mentioned (with the advantage of already > being done!). > > It seems to work pretty well in the simple case, although I haven't done > more than play with it. Thanks are due to Jose Calvo for the effort. > > HTH, > > Don > > |
Seb,
> I'm right now testing the code that you mention. > > This package, seems to be useful taking the 'hard path' of > programatically sending an email. For usual smtp it is already fuctional, I > only need to add the smtp authentication requeriment in some sort of > SMTPAuthenticatedSocket that I'm trying to implement. It's no so trivial > because of the authentication protocol. I'm studying the RFC 2045 and 2554 > to know details to authenticate and prepare the email. I may be missing something, but if you are just trying to send emails there is a much easier solution. D5 Standard Edition and above ship with a package called CDO pre-installed in the image. CDO is a wrapper around Microsoft's Collaboration Data Objects which is an interface to the e-mail system of MS Outlook. If you have Outlook installed (not sure about Outlook Express) then sending an e-mail becomes just a few simple calls. There is an overview of CDO here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dncdo121/ht ml/collabdataobjs.asp We use this facility in the CGI application that handles registrations for Dolphin trial users. Below is the method that sends an e-mail out to the trial user with a new serial number. Best Regards, Andy Bower Dolphin Support http://www.object-arts.com --- Are you trying too hard? http://www.object-arts.com/Relax.htm --- TrialRegistration>>sendSerialNumber: sn "Private - Send <DolphinSerialNumber> sn to the person performing this registration" | namespace configFields config stm msg productName | config := CDOIConfiguration new. configFields := config fields interface. namespace := 'http://schemas.microsoft.com/cdo/configuration/'. (configFields item: namespace, 'sendusing') value: 2. (configFields item: namespace, 'smtpserver') value: 'smtp.object-arts.com'. (configFields item: namespace, 'smtpserverport') value: 25. configFields Update. stm := self registrationEmailMessage formatWith: sn product fullName with: sn displayString with: sn expiryDate displayString. msg := CDOIMessage new. "(msg fields item: 'urn:schemas:httpmail:importance') value: cdoHigh." (msg fields interface item: 'urn:schemas:httpmail:priority') value: cdoPriorityUrgent. msg fields interface Update. msg configuration: config; from: '[hidden email]'; "cc: '[hidden email]';" to: (params at: #Email); subject: ('%1 Trial Registration' formatWith: sn product fullName); autoGenerateTextBody: true; textBody: stm; "mdnRequested: true;" Send. ----- |
Andy Bower wrote:
> CDO is a > wrapper around Microsoft's Collaboration Data Objects which is an > interface to the e-mail system of MS Outlook. If you have Outlook > installed (not sure about Outlook Express) then sending an e-mail > becomes just a few simple calls. The MS doc seems adamant that you have to be an exchange client to use CDO (and I most definitely am NOT -- I wouldn't have Outlook on my machine even it it were free). So I was very surprised to find that this does work for me. Simple test extracted from Andy's example, and with most of the explicit configuration removed (so it, e.g, uses the default SMTP server -- and will fail if there isn't one set up). ================ (CDOIMessage new) to: '[hidden email]'; subject: 'Test'; textBody: 'Just Testing'; Send. ================ (I'm running W2K -- I don't know what would happen with, say, W98) -- chris |
I wrote:
> The MS doc seems adamant that you have to be an exchange client to > use CDO (and I most definitely am NOT -- I wouldn't have Outlook on > my machine even it it were free). So I was very surprised to find > that this does work for me. It seems that I'm using CDO for Windows 2000 http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cdosys/html/_c dosys_about_cdo_for_windows_2000.asp which -- apparently -- makes no use of MAPI at all. Hence is independent of Exchange, at least that's how I understand it -- I'm still trying to get my head around the relationship between CDO4W2K and the "old-style" version. As far as I can tell, but I might easily be wrong, if you are reading CDO documents that refer to the "Session" object, then you are using the old-style stuff, if not then you are reading about the newer version. Given the absence of a class in the CDO package with a name like 'CDOISession', I assume that the Dolphin implementation is a wrapper for "new" CDO ? Incidently, if this is true, then the Package comment about "having an SMTP server *installed*" (my emphasis) are very misleading. You *may* have one installed locally (if you are running W2K server, I think), but for the typical installation, CDO would talk to your ISP's SMPT server. It's because of that comment that I had ignored the CDO wrapper, after all I *know* I have no SMTP server running. -- chris |
In reply to this post by Chris Uppal-3
Chris,
"Chris Uppal" <[hidden email]> wrote in message news:3eba2c1d$0$45180$[hidden email]... > Andy Bower wrote: > > > CDO is a > > wrapper around Microsoft's Collaboration Data Objects which is an > > interface to the e-mail system of MS Outlook. If you have Outlook > > installed (not sure about Outlook Express) then sending an e-mail > > becomes just a few simple calls. A potential problem with CDO, though, is contending with the fixes MS provided after the rash of e-mail viruses a year or so ago. If you have the Outlook E-Mail Security Update installed, you get an annoying prompt when you try to send e-mail through CDO or the Outlook object model. The prompt tells you that something's trying to access your address book, and gives the option to deny access or to permit it once or for a period of time. There are workarounds, both administrative (Outlook Security Admin for Exchange) and technical (Dmitry Strebelchenko's Outlook Redemption), but it's not as simple as it was for the folks who wrote the ILOVEYOU virus. IIRC, CDOSYS doesn't have the same limitations, but that's not much help on Win9x/ME. > The MS doc seems adamant that you have to be an exchange client to use CDO (and > I most definitely am NOT -- I wouldn't have Outlook on my machine even it it > were free). So I was very surprised to find that this does work for me. I haven't used CDO (from Outlook or Office) or CDOSYS (CDO for Windows 2000) outside of an Exchange-based environment much, but there are ways to get it installed and working. It is not, however, a straightforward process. [...] > (I'm running W2K -- I don't know what would happen with, say, W98) Out of curiosity, telnet into port 25 on your W2K machine. I just did it on my XP system, and, to my surprise, an SMTP server answered, even though I didn't explicitly set one up! What a timesaver, eh? Don > > -- chris > > > |
In reply to this post by Smalltalkiano-4
Seb,
"Smalltalkiano" <[hidden email]> wrote in message news:b9c9fv$hokas$[hidden email]... [...] > This package, seems to be useful taking the 'hard path' of > programatically sending an email. For usual smtp it is already fuctional, I > only need to add the smtp authentication requeriment in some sort of > SMTPAuthenticatedSocket that I'm trying to implement. It's no so trivial > because of the authentication protocol. I'm studying the RFC 2045 and 2554 > to know details to authenticate and prepare the email. I don't suppose you could impose on the system administrator to set up a different means of authentication? It might require setting up SMTP service on a different port with different settings (authentication by IP or plain-text password if you're on a secure network). HTH, Don > > regards, > > Seb |
Don,
I've solved the SMTP AUTH LOGIN protocol by now, and succesfully sent several mails using this humble socket, so I think to develop by this way values the effort. I know there is several authentication protocols like Digest-MD5, CRAM-MD5, etc. but they are much more complex than LOGIN, and as far as I know, the LOGIN seems to be very common between SMTP servers. I'm working on a little framework to easily send an e-mail from the dolphin, right now I'm trying to send mails with attachments. regards, Seb "Don Rylander" <[hidden email]> escribió en el mensaje news:b9duvp$ic4g4$[hidden email]... > Seb, > "Smalltalkiano" <[hidden email]> wrote in message > news:b9c9fv$hokas$[hidden email]... > [...] > > This package, seems to be useful taking the 'hard path' of > > programatically sending an email. For usual smtp it is already fuctional, > I > > only need to add the smtp authentication requeriment in some sort of > > SMTPAuthenticatedSocket that I'm trying to implement. It's no so trivial > > because of the authentication protocol. I'm studying the RFC 2045 and 2554 > > to know details to authenticate and prepare the email. > I don't suppose you could impose on the system administrator to set up a > different means of authentication? It might require setting up SMTP service > on a different port with different settings (authentication by IP or > plain-text password if you're on a secure network). > > HTH, > > Don > > > > > regards, > > > > Seb > > |
In reply to this post by Andy Bower
Dear Andy,
as I see this approach of sending an e-mail is cdo.dll dependent. I didn't find this dll on my system, perhaps it belongs to som Microsoft SMTP server that I haven't installed? This could help on some server application, but I don't think could be applicable to some final client-user application. If you see I misunderstood something please tell me. regards, Seb "Andy Bower" <[hidden email]> escribió en el mensaje news:3eba2473$[hidden email]... > Seb, > > > I'm right now testing the code that you mention. > > > > This package, seems to be useful taking the 'hard path' of > > programatically sending an email. For usual smtp it is already fuctional, > I > > only need to add the smtp authentication requeriment in some sort of > > SMTPAuthenticatedSocket that I'm trying to implement. It's no so trivial > > because of the authentication protocol. I'm studying the RFC 2045 and 2554 > > to know details to authenticate and prepare the email. > > I may be missing something, but if you are just trying to send emails there > is a much easier solution. D5 Standard Edition and above ship with a package > called CDO pre-installed in the image. CDO is a wrapper around Microsoft's > Collaboration Data Objects which is an interface to the e-mail system of MS > Outlook. If you have Outlook installed (not sure about Outlook Express) then > sending an e-mail becomes just a few simple calls. > > There is an overview of CDO here: > > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dncdo121/ht > ml/collabdataobjs.asp > > We use this facility in the CGI application that handles registrations for > Dolphin trial users. Below is the method that sends an e-mail out to the > trial user with a new serial number. > > Best Regards, > > Andy Bower > Dolphin Support > http://www.object-arts.com > --- > Are you trying too hard? > http://www.object-arts.com/Relax.htm > --- > > TrialRegistration>>sendSerialNumber: sn > "Private - Send <DolphinSerialNumber> sn to the person performing this > registration" > > | namespace configFields config stm msg productName | > config := CDOIConfiguration new. > configFields := config fields interface. > namespace := 'http://schemas.microsoft.com/cdo/configuration/'. > (configFields item: namespace, 'sendusing') value: 2. > (configFields item: namespace, 'smtpserver') value: > 'smtp.object-arts.com'. > (configFields item: namespace, 'smtpserverport') value: 25. > configFields Update. > > stm := self registrationEmailMessage formatWith: sn product fullName > with: sn displayString > with: sn expiryDate displayString. > > msg := CDOIMessage new. > "(msg fields item: 'urn:schemas:httpmail:importance') value: cdoHigh." > (msg fields interface item: 'urn:schemas:httpmail:priority') value: > cdoPriorityUrgent. > msg fields interface Update. > msg > configuration: config; > from: '[hidden email]'; > "cc: '[hidden email]';" > to: (params at: #Email); > subject: ('%1 Trial Registration' formatWith: sn product > autoGenerateTextBody: true; > textBody: stm; > "mdnRequested: true;" > Send. > ----- > > |
Smalltalkiano wrote:
> as I see this approach of sending an e-mail is cdo.dll dependent. > I didn't find this dll on my system, perhaps it belongs to som > Microsoft SMTP server that I haven't installed? The link that Andy posted is misleading. Try the one that I posted. In particular, cdo.dll etc, are *not* used by CDO for Win2K. The dll is, IIRC, cdosys.dll. Also CDO for Win2K is not in any way dependent on your having an SMTP server installed anywhere. If you can send outgoing emails using any mail client then you have *access* to an SMTP server somewhere on the Net (probably at your ISP for personal machines, and -- I'd guess -- most office machines too). If so then CDO for Win2K will be able to talk to it. *However*, the MS site claims that CDO for Win2K is only available for Win2K (and XP, presumably), not for W98/95/ME. It would have helped if Microsoft hadn't called their new facility for sending SMTP/NNTP messages "CDO for Win2K" since it doesn't seem to have much in common with the COM wrapper for MAPI (for talking to Exchange servers) that is also called "CDO". -- chris |
In reply to this post by Don Rylander-3
Don Rylander wrote:
> A potential problem with CDO, though, is contending with the fixes MS > provided after the rash of e-mail viruses a year or so ago. If you > have the Outlook E-Mail Security Update installed, you get an > annoying prompt when you try to send e-mail through CDO or the > Outlook object model. Interesting. I'd have thought that they'd have put the same protection around the Outlook *Express* configuration too, but I see no such prompt. Of course, CDO for Win2K only needs to touch a very little bit of the OE config (just to find the default NNTP and SMTP servers), which is a lot less "iffy" than reading the actual address book. > > The MS doc seems adamant that you have to be an exchange client to > > use CDO (and I most definitely am NOT -- I wouldn't have Outlook on > > my machine even it it were free). So I was very surprised to find > > that this does work for me. > I haven't used CDO (from Outlook or Office) or CDOSYS (CDO for > Windows 2000) outside of an Exchange-based environment much, but > there are ways to get it installed and working. It is not, however, > a straightforward process. Eh ? CDO for Win2K works straight out of the box on my machine. I've never had anything to do with Exchange, and -- as I say -- am not running an SMTP server. -- chris |
Chris,
"Chris Uppal" <[hidden email]> wrote in message news:3ebb7a68$1$45180$[hidden email]... [...] > Interesting. I'd have thought that they'd have put the same protection around > the Outlook *Express* configuration too, but I see no such prompt. Of course, > CDO for Win2K only needs to touch a very little bit of the OE config (just to > find the default NNTP and SMTP servers), which is a lot less "iffy" than > reading the actual address book. I haven't tried accessing Outlook Express through COM, but from what I've seen in MS newsgroups, people who do are typically surprised and frustrated at how little of the underlying stuff is exposed. IIRC, OE also doesn't support scripting to the extent that Outlook does (e.g., "one-off" forms), so I suspect there isn't the same risk. [...] > Eh ? CDO for Win2K works straight out of the box on my machine. I've never > had anything to do with Exchange, and -- as I say -- am not running an SMTP > server. You're right. I guess it wasn't quite clear, but I just meant to say pre-Win2K (Win9x, NT 4) systems. CDO for Windows 2000 (which I *believe* is so far always synonymous with CDOSYS in MS docs) comes standard on 2K and XP. Don |
In reply to this post by Chris Uppal-3
Seb and Chris,
This whole area seems to be in a real state of flux right now. MS seems to be moving away from its proprietary MAPI technology and "embracing" more standard protocols (SMTP, POP3, etc.). No doubt the "extension" phase will be coming soon. It's especially annoying right now building on things like Outlook, because you end up having so many ways of doing almost the same things, but each has its own limitations and peculiarities. Oh, well. Don |
Free forum by Nabble | Edit this page |