E-mails saved as draft when using Mail Codeunit 397

ssewanissewani Member Posts: 5
Hello,

I need to send an order acknowledgment e-mail from the sales order form-- to do this I'm using the Mail Codeunit (397); the process has to be transparent, this is why I've set the OpenDialog flag to false. The problem is that instead of sending the e-mails, outlook is saving them to the draft folder. What am I doing wrong, why are the e-mails not sent?

The environment is: Windows XP SP2, Navision 4.00 SP3 and Microsoft Outlook 2007.
Sent := Mail.NewMessage(Customer."E-Mail",'',Subject,Body,'',FALSE)

Thanks

Answers

  • WaldoWaldo Member Posts: 3,412
    what is the value of the "Sent" boolean?
    Is the ErrorNo (in the function itself) giving you any value?

    What is you add an extra line:
    Sent := Mail.Send;
    

    Eric Wauters
    MVP - Microsoft Dynamics NAV
    My blog
  • ssewanissewani Member Posts: 5
    Good question,

    The value of "Sent" is Yes/True. If I ignore the "Sent" variable and call the GetErrorCode or GetErrorDesc() functions I get the following error:

    "Integer must not be blank.
    Integer is missing or invalid in the expression."

    Activating the debugger I've learned that the error comes from the Get functions in the codeunit. I also modified the Mail codeunit to print the error code before exiting the NewMessage function, it prints "0".
  • WaldoWaldo Member Posts: 3,412
    Hm, this is weird.
    Tried to do it with dialog and push the send button manually?

    Eric Wauters
    MVP - Microsoft Dynamics NAV
    My blog
  • ssewanissewani Member Posts: 5
    Calling the send function causes the following error:

    "Boolean must not be blank.
    Boolean is missing or invalid in the expression."


    and the e-mail is still saved to my draft folder.
  • darshanmdarshanm Member Posts: 280
    Namaste!

    In your Outlook office client, activate Automatic Send/Receive
    for every 2 mints
    Darshan Mungekar
    Senior Consultan
  • ssewanissewani Member Posts: 5
    weird, this worked. Wasn't what I expected. Thanks
  • hawkeyehawkeye Member Posts: 51
    I have the opposite problem.

    I want to create a number of mails but I don´t want them to be send or opened but to be saved in the draftfolder.

    If I set the OpenDialog to True I get 100 (or so) open mails, If I set the OpenDialog to False all the mails will be send automatical.

    should I use the mail management codunit 6229 instead? Using this codeunit I just cant see how to attach files or make a bodytext.
Sign In or Register to comment.