To send via Outlook you need MAPI, not sure what template implement that. Most send direct via SMTP. Thats what I do.
Having said that the landscape has changed a little and Office365 is all cloud, so that makes it a little harder. I know nettalk does OAUTH that you now need to talk to most cloud things. But beyond that I don’t know.
I use the Clarion ClaTalk.SendMail method that uses the ClaRunExt.DLL.
I let the user view the report (e.g. a client invoice). I have a Clarion form that has the email fields to send it as an attachment to the client. The message can be modified before it is sent, or it doesn’t have to be sent. (One button creates the report and opens the form).
I put the sender as a cc, so they get a copy, which can be received in Outlook or whatever the user has.
This program is run from a Windows Server computer, so I don’t need to have Outlook or any other email program installed on the server. I’m using Clarion 11 and the wPDFControl template from Klarisoft to create PDF reports.
Another example is emailing paystubs to employees. Since they have direct deposit, this lets them get an email with their PDF paystub as an attachment. The program sends each employee their own paystub, so of course the program creates a separate email and report file for each employee. A cc for each email is sent to the payroll admin. In this case, each paystub is not previewed before sending.
In my application, I have an Email Log file, which of course keeps track of the emails that are sent, to whom, subject line, client name, and company. So in the application, the user can see the emails that are sent to a client when viewing the company record, so the user doesn’t have to go to Outlook to see it. The emails are cc’d to the user so they get to see them in Outlook too.
I have been using a Softmaster’s Office Integration for many years. Works really well.
You can send the emails “blind”, meaning Outlook is not opened in the screen, yet the emails sits in the Sent Items folder.
I’ve been researching some of the answers based on feasibility, ease, and price.
And after reading some information pages, I found an easy and free solution: the Outlook command line.
Using the RUN() command, I just call outlook and pass it the parameters I need: email, subject, body, and the attached file.
And it looks like this:
!LOC:OutlookCommand is a local variable to store all the string that is passed to the RUN() command.
!GLO:Outlook is the path where outlook is installed. It can be empty if Windows finds the path automatically.
!CLI:Email is the client email (string)
!GLO:Subject is the email's subject (string)
!GLOBody is the email's body (string)
!Glo:Path is the path to the attachment file
LOC:OutlookCommand = Clip(GLO:Outlook)&' /c ipm.note /m "'&Clip(CLI:Email)&'?subject='&Clip(GLO:Subject)&'&body='&Clip(GLO:Body) &GLO:Path
When executed, Outlook opens and it gets automatically pre-popullated, so the user can change anything before sending it and once sent, the email is stored in the SENT folder.
Thank you all guys for all your suggestions. They all helped me find this one.
This would be the complete line command without Clarion variables:
LOC:ComandOutlook = 'C:\Program Files\Microsoft Office\Office16\OUTLOOK.EXE /c ipm.note /m "'[email protected]'?subject=Meeting tomorrow&body=Hey team, remember that we have an a team chat tomorrow at ClarionHub.com" /a "C:\path\to\file.pdf"')
Just replace all the variables needed and, specially, respect the "
Actually, you can send a lot of switches. Check this page out for the full list of them: