Navision and outlook automation

TimSmithTimSmith 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

                

Comments

  • krikikriki Member, Moderator Posts: 9,118
    Best way is to take some aspirine :D

    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!


  • TimSmithTimSmith Member Posts: 36
    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. :-k
  • FeldballeFeldballe Member Posts: 26
    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.
  • krikikriki Member, Moderator Posts: 9,118
    Feldballe wrote:
    Anyway using a SMTP-server could create a security risk, marking your mail-domain as a possible spam-central.
    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.
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


Sign In or Register to comment.