Page 1 of 1

Having Jade initiate an email in outlook

Posted: Fri Aug 07, 2009 2:33 pm
by ConvertFromOldNGs
by Carl Ranson >> Fri, 6 Apr 2001 3:07:36 GMT

Hi All...im back,

I want to have my jade application create a new email in outlook, put in some default message and address, and attach a file or two. The user will be responsible for sending the message.

I know that many of us have done this in the past, and would apreciate any code that people are able to share.

Thanks,
CR

btw, I've been playing with the following technique, which works for short messages, but doesn't seem to allow attachments.
Its probably the fastest way to get an email though:

vars
command, alias : String;
args : StringArray;
exitValue : Integer;
result : Integer;
today : Date;begin

command := "command.com" ;
create args transient;
args[1] := '/c ';
args[2] := "start mailto:me@home.com?body=Message%20Body%0d%0aGoes%20here;subject=test;
result := node.createExternalProcess("c:\winNT\System32", "cmd.exe", args, alias, false, false, exitValue);
// result := node.createExternalProcess("c:\windows\System32", "command.com", args, alias, false, false, exitValue);
end;

Re: Having Jade initiate an email in outlook

Posted: Fri Aug 07, 2009 2:33 pm
by ConvertFromOldNGs
by Craig Shearer >> Sun, 8 Apr 2001 22:18:14 GMT

Hi Carl

You're back... from where? (Did we notice you gone???)

If sending email is your goal, then CardSchema is by far the best way to do it. Get it, it's easy! - and you can have attachments!

Craig.

Re: Having Jade initiate an email in outlook

Posted: Fri Aug 07, 2009 2:33 pm
by ConvertFromOldNGs
by Wilfred Verkley >> Mon, 9 Apr 2001 23:22:23 GMT
If sending email is your goal, then CardSchema is by far the best way to do it. Get it, it's easy! - and you can have attachments!

Depends if you want a server based component (ie SMTP based ones) or something that automates a persons mail client (ie MAPI-based components or Outlook OLE Automation).

In my experience server-based SMTP components are good for mailing list or server-based applications, while client-side mail components are better for personal work flow type applications.

The easiest way to control outlook (assuming you want outlook only), is to use Outlook OLE automation.

i.e. some simple VB code :

Dim objOutlook As New Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
objOutlookMsg.To = "craig.shearer@bigfoot.com"
objOutlookMsg.Subject = "hello"
objOutlookMsg.body = "just testing"
objOutlookMsg.Attachments.add "c:\pagefile.sys"
objOutlookMsg.Send

You should be able to do all this in Jade too using the COM functionality, the the code will be a little bit more convoluted i suppose i.e. no support for optional parameters (i wish Jade had just supported late-bound IDispatch interfaces).

Re: Having Jade initiate an email in outlook

Posted: Fri Aug 07, 2009 2:33 pm
by ConvertFromOldNGs
by Carl Ranson >> Mon, 9 Apr 2001 23:44:04 GMT

Thanks, Wilfred.

Outlook OLE is the way I went with this. Doing it straight from Jade went in the "too hard" basket pretty quick though. I just wrote a wrapper dll in Delphi 5.

Turned out to be pretty easy to do using this combination of technologies.

Cheers,
CR