Navision and outlook automation
TimSmith
Member Posts: 36
:shock:
Have got a problem which has me staring at the screen!!!!!!!
I am running a code unit which has a number of loops. The object of the exercise is to create a spreadsheet of data for a number of individuals. At the end of each loop an email is created. The method of creating the email is to pass the relevant information into CU397. So far no problems.
Having generated all of the reports, I want to start outlook and automatically send the emails that have been generated. This I can do manually, but the whole purpose of the exercise is to run this job as a scheduled task.
I can generate the emails and send using outlook automation, but get the pop up message that is generated from outlook warning of a program trying to use email and potential virus etc.....
How can i get round this. i have tried a number of actions and my latest code looks as follows.....
// Email the file to the employee
// Using CU397
IF fldempread>0 THEN
IF NOT mail.NewMessage('tims@tesl.com','',text001,text001,fldfilename,FALSE) THEN
mail.NewMessage('tims@tesl.com','',text002,text002,fldfilename,FALSE);
// Using Outlook automation
// CLEAR(OLMailitem);
// CLEAR(OLAttachments);
// OLMailitem := outlook.CreateItem(0);
// OLMailitem."To"('tims@tesl.com');
// OLMailitem.Subject('outlook');
// OLAttachments := OLMailitem.Attachments();
// OLAttachments.Add(fldfilename);
// OLMailitem.Send;
UNTIL tblres.NEXT=0;
excel.Quit;
// SLEEP(60000);
CLEAR(outlook);
CREATE(MAPISession,FALSE);
MAPISession.Logon('','',FALSE,FALSE);
MAPISession.DeliverNow();
MAPISession.Logoff();
CLEAR(MAPISession);
Have now spent far to long in trying to resolve ](*,) Help as the headache is becomming unbearable.......
Tim
Have got a problem which has me staring at the screen!!!!!!!
I am running a code unit which has a number of loops. The object of the exercise is to create a spreadsheet of data for a number of individuals. At the end of each loop an email is created. The method of creating the email is to pass the relevant information into CU397. So far no problems.
Having generated all of the reports, I want to start outlook and automatically send the emails that have been generated. This I can do manually, but the whole purpose of the exercise is to run this job as a scheduled task.
I can generate the emails and send using outlook automation, but get the pop up message that is generated from outlook warning of a program trying to use email and potential virus etc.....
How can i get round this. i have tried a number of actions and my latest code looks as follows.....
// Email the file to the employee
// Using CU397
IF fldempread>0 THEN
IF NOT mail.NewMessage('tims@tesl.com','',text001,text001,fldfilename,FALSE) THEN
mail.NewMessage('tims@tesl.com','',text002,text002,fldfilename,FALSE);
// Using Outlook automation
// CLEAR(OLMailitem);
// CLEAR(OLAttachments);
// OLMailitem := outlook.CreateItem(0);
// OLMailitem."To"('tims@tesl.com');
// OLMailitem.Subject('outlook');
// OLAttachments := OLMailitem.Attachments();
// OLAttachments.Add(fldfilename);
// OLMailitem.Send;
UNTIL tblres.NEXT=0;
excel.Quit;
// SLEEP(60000);
CLEAR(outlook);
CREATE(MAPISession,FALSE);
MAPISession.Logon('','',FALSE,FALSE);
MAPISession.DeliverNow();
MAPISession.Logoff();
CLEAR(MAPISession);
Have now spent far to long in trying to resolve ](*,) Help as the headache is becomming unbearable.......
Tim
0
Comments
-
Best way is to take some aspirine

I am afraid it is not so easy.
Some things that you can try:
1) If you use Exchange-server, there is a Security-pack that gives you the possibility that outlook doesn't ask that stupid question anymore.
2) There is an external tool (ClickYes ; search the forum for more info) that clicks the yes-button for you.
3) use Outlook Express and write your own code. Outlook Express has an option to not ask that question
4) use SMTP to create your emails. http://www.mibuso.com/forum/viewtopic.php?t=3475
5) Search the forum for more info. There is a lot of info on this. (What I wrote is in short all the possibilities I found)Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
Thanks Alain,
I have spent a lot of time researching this and seem to have come to the same conclusions. i suppose I was hoping against hope that there was a solution that I had missed. :-k0 -
Still if you are using Exchange Server version 2003, you might have a problem with how to send unsolicited email using SMTP-server.
Anyway using a SMTP-server could create a security risk, marking your mail-domain as a possible spam-central.0 -
True, so it is a good idea to control the outgoing email and if something is not ok, you know someone is doing something he shouldn't do. In this case you can change the sending address. Or you might also put some text in each email and if it hasn't that text, the server doesn't send it, but sends it to the admin.Feldballe wrote:Anyway using a SMTP-server could create a security risk, marking your mail-domain as a possible spam-central.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 328 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions