Subscribe for automatic updates: RSS icon RSS

Login icon Sign in for full access | Help icon Help
Advanced search

Pages: [1]
  Reply  |  Print  
Author Topic: Winmail MAPI enhancement request.  (Read 23300 times)
David H.
Posts: 158


« on: March 21, 2011, 11:46:35 am »

Hi,

Just had my first look at the Winmail extension. It would be nice if the MAPI version had the option to directly send the email with no user/UI interaction (i.e. like the SMTP option). It could then be used in a batch process.

Regards,

David
David H.
Posts: 158


« Reply #1 on: March 22, 2011, 11:14:04 am »

On the same subject it would be nice if there was a way I could check if a MAPI compatible client was available before trying to send an email. My preference would be to send via MAPI (with its UI) if available and if not then via SMTP.

Also with MAPI if the user cancels the dialog an error is returned "The user canceled one of the dialog boxes. No message was sent." For me cancelling the dialog should not be treated as an error condition. My suggestion would be that SendMail should return FALSE (as email not sent), but GetError() NULL as no error actually occurred...
Reuben B.
Four Js
Posts: 1113


« Reply #2 on: March 22, 2011, 09:45:11 pm »


Also with MAPI if the user cancels the dialog an error is returned "The user canceled one of the dialog boxes. No message was sent." For me cancelling the dialog should not be treated as an error condition. My suggestion would be that SendMail should return FALSE (as email not sent), but GetError() NULL as no error actually occurred...

Hi David,

Did you see the warning in the documentation https://4js.com/online_documentation/fjs-gdc-manual-html/User/WinMail.html#SendMail

Quote
"MAPI depends on the mailer software for error management. For instance, Mozilla Thunderbird returns "success" when the mail is created, but Outlook 2002 only returns "success" when the mail is sent."


Reuben

Product Consultant (Asia Pacific)
Developer Relations Manager (Worldwide)
Author of https://4js.com/ask-reuben
Contributor to https://github.com/FourjsGenero
Reuben B.
Four Js
Posts: 1113


« Reply #3 on: March 22, 2011, 10:06:07 pm »

Hi,

Just had my first look at the Winmail extension. It would be nice if the MAPI version had the option to directly send the email with no user/UI interaction (i.e. like the SMTP option). It could then be used in a batch process.

Regards,

David

The WinMail extension is a GDC frontcall.    If you have a batch process, by that I'm interpreting you mean something like a cron-job that is scheduled to run periodically, you aren't going to have a front-end through which you can use the GDC frontcall.

Personally I think we have a gap there in that we should provide a class similar to the File Management Class so that developers can easily write a batch program that sends mail via SMTP Server i.e.

Code
  1. IMPORT mail
  2.  
  3. DEFINE m mail.message
  4.  
  5. LET m = mail.create()
  6. CALL m.setSMTP(ipaddress)
  7. CALL m.addTo(name)
  8. CALL m.setSubject(subject)
  9. LET ok = m.send()  


However one of the reasons for introducing the Java Interface in 2.20 was so that you had access to the wide world of Java libraries that are out there.  For a batch process sending lots of automated mail I'd consider using the Java Interface in conjunction with JavaMail.  Alternatively as Scott demonstrated here http://code.google.com/p/sourcefourjs/wiki/ABasicSMTPClient you could even use base.Channel to communicate with a SMTP Server.



Product Consultant (Asia Pacific)
Developer Relations Manager (Worldwide)
Author of https://4js.com/ask-reuben
Contributor to https://github.com/FourjsGenero
.
Four Js
Posts: 115


« Reply #4 on: March 23, 2011, 09:03:28 am »

All,

Please also note that currently, WinMAIL uses the old API (which was not old when we wrote the code): http://msdn.microsoft.com/en-us/library/dd296734%28VS.85%29.aspx

See:

Quote
[The use of Simple MAPI is discouraged. It may be altered or unavailable in subsequent versions of Windows.]

The API is pretty simple and there is not so much configuration options, and as Reuben underlined, the result is really dependent on the mailer. We'll see how we can tweak our code, but a mid term solution would be to add Outlook 2007 / Outlook 2010 MAPI support:

http://msdn.microsoft.com/en-us/library/cc765775%28v=office.12%29.aspx

which seems to provide much more options.
David H.
Posts: 158


« Reply #5 on: March 23, 2011, 09:49:00 am »

Did you see the warning in the documentation

I did but I still think cancelling the dialog should not be reported as an error as such. I've ended up excluding it by pattern matching on the error string returned so hopefully you won't change the error text returned (apart from correcting the spelling mistake perhaps).
.
Four Js
Posts: 115


« Reply #6 on: March 23, 2011, 10:05:41 am »

David,

we just follow Microsoft API definition:

http://msdn.microsoft.com/en-us/library/dd296721%28v=VS.85%29.aspx

either the function returns SUCCESS_SUCCESS, or it returns one of the error number MAPI_E_xxx ( MAPI_E_USER_ABORT in this case). So if the call does not return SUCCESS_SUCCESS, Microsoft considers this is an error, we just did the same.

The error text is copied from the same page, so it will not change as I don't think Microsoft will change the page. (BTW, could you underline the spelling mistake ? - I'm not native English speaker and we simply copied the strings from MSDN...)
David H.
Posts: 158


« Reply #7 on: March 23, 2011, 10:21:10 am »

Hi Reuben,

Re: no user interaction. I prefer MAPI for end users as it has no extra configuration required and uses the email client to create the email so users have full control over what is sent via the UI of their MAPI client.

However I'd still on occasions like a user to be able to send via MAPI without user interaction. For example we have a report mail trigger option where users (via a configuration screen) can pick reports from our report list (500+ now!) and request that a given report is mailed automatically whenever it is generated (they enter the to,cc,bcc, subject and message etc for a skeleton email). Once setup whenever they generate a sequence of reports the ones which have a trigger setup are automatically emailed silently to the recipients.

To code around this I now use MAPI for interactive emails and SMTP for the non interactive ones. This works but requires extra work at configuration time as the SMTP option needs a server/port and a from address to work.

Lionel F.
Four Js
Posts: 83


« Reply #8 on: March 23, 2011, 10:29:21 am »

Hi David,

The question is to know if what you're expecting is doable by the WinMail API (or not). It requires to be investigated. We filed your enhancement requests so that we can track:
  • #19444 => WinMail: having a way to send an email through MAPI without user interaction
  • #19445 => WinMail: detecting if there is a compatible a MAPI client
  • #19446 => WinMail should not return an error when canceling the dialog with the mailer

You can keep a follow-up by consulting our "Issue tracker" that is available from our website.

Best regards,
Lionel
David H.
Posts: 158


« Reply #9 on: March 23, 2011, 10:30:54 am »

RE: spelling, maybe its a regional thing but in the UK canceled  would be written as cancelled..
Lionel F.
Four Js
Posts: 83


« Reply #10 on: March 23, 2011, 10:32:58 am »

  • #19444 => WinMail: having a way to send an email through MAPI without user interaction
  • #19445 => WinMail: detecting if there is a compatible MAPI client
  • #19446 => WinMail should not return an error when canceling the dialog with the mailer

Sorry David,
read #19944, #19945 and #19946...

Regards,
Lionel
Reuben B.
Four Js
Posts: 1113


« Reply #11 on: March 23, 2011, 10:51:23 pm »

Hi Reuben,

Re: no user interaction. I prefer MAPI for end users as it has no extra configuration required and uses the email client to create the email so users have full control over what is sent via the UI of their MAPI client.

However I'd still on occasions like a user to be able to send via MAPI without user interaction. For example we have a report mail trigger option where users (via a configuration screen) can pick reports from our report list (500+ now!) and request that a given report is mailed automatically whenever it is generated (they enter the to,cc,bcc, subject and message etc for a skeleton email). Once setup whenever they generate a sequence of reports the ones which have a trigger setup are automatically emailed silently to the recipients.

To code around this I now use MAPI for interactive emails and SMTP for the non interactive ones. This works but requires extra work at configuration time as the SMTP option needs a server/port and a from address to work.



Requiring a from address in order for SMTP to work can have its benefits.  This allows you to send mails as from "accounts@yourcompany.com" etc rather than through the email account of the person who happens to be running the report.

Also just be aware that the WinMail front-calls are GDC only. I had a recent support case where someone was trying to use them and couldn't get them to work, turned out they were using GWC.

Product Consultant (Asia Pacific)
Developer Relations Manager (Worldwide)
Author of https://4js.com/ask-reuben
Contributor to https://github.com/FourjsGenero
David H.
Posts: 158


« Reply #12 on: March 24, 2011, 12:00:15 pm »

Also just be aware that the WinMail front-calls are GDC only. I had a recent support case where someone was trying to use them and couldn't get them to work, turned out they were using GWC.

Yes indeed. I like the fact that Winmail is built in and needs no 3rd party product installing, but the email solution being built into GDC does present some difficulties. We also have a requirement to email from console mode programs which run batch processes with no UI or GDC, I think a server side SMTP class as you mentioned previously would be a good solution for this. Either that allow the easy integration of .Net and ActiveX components server side (like the Java interface) so they can be used just like any other class. I suppose we could investigate the Java interface but we are not Java programmers and have had bad experiences previous with different runtime versions and messing around with CLASSPATH's when trying to get even simple Java classes to run on Windows.  ActiveX and .Net would be a much better fit for us...
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines