Hi all,
I just found this site and I love it! I've been struggling to find Navision resources on the web to help me and it's like I've hit the jackpot! My problem is...
(history: you can skip this part)
I've been playing with various ways of sending email from Navision. I've done.
1) shell command to mailto: url, which worked ok but I couldn't get the body to support a navision:// hyperlink.
2) then I used Outlook Automation to send an email and that seemed to work except it popped up a message box askng to allow Navision to send email through outlook.
3) then I thought about using the SMTP OCX module but I didn't want to have to install the OCX file to all the client computers or have to share it out on a network drive.
4) which brings me to ....
I'm trying to send an email out using CDO for windows 2000 (which is preinstalled on windows 2000 and windows XP). I believe I'm almost there. The only problem I'm having is that I don't know how to handle the ADOBE recordset which consists of name/value pairs in Navision.
The CDO.IConfiguration FIELDS method returns a recordset with name/value pairs. I'm not sure how to code Navision to handle the name/value pairs.
Any help would be appreciated.
Thanks!
The following code doesn't work but here it is...
IF ISCLEAR(objEmailConf) THEN CREATE(objEmailConf);
Flds := objEmailConf.Fields; '<--- not sure what datatype to use for Flds
Flds('sendusing') := 2; '<--- not sure how to set the name/value pairs
Flds('smtpserver') := 'exchange';
Flds('smtpserverport') := 25;
Flds.Update;
IF ISCLEAR(objEmail) THEN CREATE(objEmail);
objEmailIMsg := objEmail;
objEmailIMsg.From :=
'test@blah.com';
objEmailIMsg."To" :=
'blah@blah.com';
objEmailIMsg.Subject := 'TEST';
objEmailIMsg.TextBody := 'test';
objEmailIMsg.Send;
Comments
We use it for Purchase Orders today and it works well. Another product would be win2pdf which has similar functionality.
Define 'fld' as 'Microsoft ActiveX Data Objects 2.x Library'.Field.
Then assign the values as follows:
You probably know about http://www.navision.net, a sister (or rival :-))site, but I just wanted to mention it to be sure you and other posters knew. Btw, it is occasionally unavailable, like right now :-(.
Alastair
you can send email just in 1 line of code, or you can write your own mail client or email distribution center...
yes, it's an automation server, but I have seen a post which deals how to store a dll as blob in navision and when needed, automatically pull it out and store on client's machine, register it and use it on the fly...
search the forum (maybe download section)
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
Define 'objEmailConf' as 'Microsoft CDO For Exchange 2000 Library'.Configuration.
Define 'objEmail' as 'Microsoft CDO For Exchange 2000 Library'.Message.
Define 'flds' as 'Microsoft ActiveX Data Objects 2.5 Library'.Fields.
Define 'fld' as 'Microsoft ActiveX Data Objects 2.5 Library'.Field.
IF ISCLEAR(objEmailConf) THEN CREATE(objEmailConf);
flds := objEmailConf.Fields;
fld := flds.Item('http://schemas.microsoft.com/cdo/configuration/smtpserver');
fld.Value('mail.yourdomain.com');
fld := flds.Item('http://schemas.microsoft.com/cdo/configuration/smtpserverport');
fld.Value(25);
fld := flds.Item('http://schemas.microsoft.com/cdo/configuration/sendusing');
fld.Value(2);
flds.Update();
IF ISCLEAR(objEmail) THEN CREATE(objEmail);
objEmail.Configuration := objEmailConf;
objEmail.From := 'testfrom@yourdomain.com;
objEmail."To" := 'testto@yourdomain.com';
objEmail.Subject := 'test subject';
objEmail.TextBody := 'Test';
objEmail.Send;
objEmail.From := 'testfrom@yourdomain.com;
I'm running on XP. I had to use:
'Microsoft CDO for Windows 2000 Library' instead of 'Microsoft CDO For Exchange 2000 Library'
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
FYI... from MS's website.
"When you upgrade a computer running Microsoft® Windows® 2000 with Microsoft® Exchange® 2000 server, a new COM component, Microsoft CDO for Exchange 2000 replaces the Microsoft CDO for Windows 2000 component. The CDO for Windows 2000 component is a proper subset of the functionality offered by CDO for Exchange 2000, so all applications, including transport event sinks, will continue to function properly. When Microsoft Exchange 2000 is installed, the CDO for Windows 2000 component is unregistered from the system and COM runtime."
links to related info I've been using:
http://msdn.microsoft.com/library/defau ... in2000.asp
http://msdn.microsoft.com/library/defau ... bjects.asp
BTW. I'm preparing a "Simple Email Sender" using this functionality. I will probably send it here for the download section. Anybody want's to be a co-author ?
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
I have something strange...
Client with W2k / Navision - without problems.
Another machine - client with WXP from VBScript - without problems
but from Navision - error.
I can set Configuration but during Update - Automation Server
reporting error -2147352567.
Both machines - the same fin.exe
Any ideas?
Regards,
Tomasz Matejko
Do the users have to have a specific service pack for Win2000 since it only seems to happen on older machines that dont run XP.
Hi all,
i can test this code in a local pc? i'm using iis with xp.
thanks.