The following is test code that works in sending an email with attachment to the Drafts folder (option D) using Outlook 2000 or higher (at least all the versions I have available).
The program that calls this include file ( I named it EMAIL.INC) takes a method (D for Draft or S for Send) and the other items should be easy to spot what they do)
In playing around with Outlook I tried setting up a rule to move items sent to the drafts folder to another folder directly but that caused the message to act like they were to be replies. If I copied and pasted to a directory I created below the drafts folder they come up to send when I open multiple items.
The users want to create multiple folders for different managers to review the draft before sending to their clients.
The question is: How do I change the target of the
OBJECT CALL o_mlMailItem.save
statement below to be a named folder under the Drafts folder where when the user opens the item it is ready to send with a Ctrl -S.
NOTE: Using a program called Click-Yes, I've got the actual Send licked in that it removes the annoying delay when another program is using Outlook to send emails with or without attachments.
Thanks for any feedback.
Bob Mechler
The program that calls this include file ( I named it EMAIL.INC) takes a method (D for Draft or S for Send) and the other items should be easy to spot what they do)
In playing around with Outlook I tried setting up a rule to move items sent to the drafts folder to another folder directly but that caused the message to act like they were to be replies. If I copied and pasted to a directory I created below the drafts folder they come up to send when I open multiple items.
The users want to create multiple folders for different managers to review the draft before sending to their clients.
The question is: How do I change the target of the
OBJECT CALL o_mlMailItem.save
statement below to be a named folder under the Drafts folder where when the user opens the item it is ready to send with a Ctrl -S.
NOTE: Using a program called Click-Yes, I've got the actual Send licked in that it removes the annoying delay when another program is using Outlook to send emails with or without attachments.
Thanks for any feedback.
Bob Mechler
Code:
FUNCTION OEMAIL(sMethod$,sFrom$,sTo$,sSubject$,sBody$,sAttachment$) AS LONG DIM OptnTcp AS INTEGER ' ' send to draft folder or send with the help of Click-Yes ' DIM o_mlApplication AS OutlookApplication DIM o_mlNameSpace AS OutLookNameSpace DIM o_mlMailitem AS OutLookMailItem DIM vSpace AS VARIANT DIM vMapi AS VARIANT DIM vMail AS VARIANT DIM vItemType AS VARIANT DIM vSubject AS VARIANT DIM vBody AS VARIANT DIM vTo AS VARIANT DIM vVnt AS VARIANT SET o_mlApplication = NEW OutLookApplication IN $PROGID_OutLookApplication vMapi = "mapi" IF ISFALSE ISOBJECT(o_mlApplication) THEN MSGBOX("Unable to open or start Outlook") EXIT FUNCTION END IF OBJECT CALL o_mlApplication.GetNameSpace(vMapi) TO vSpace SET o_mlNameSpace = vSpace OBJECT CALL o_mlNameSpace.Logon IF ISFALSE ISOBJECT(o_mlNameSpace) THEN MSGBOX("Unable to open establish a working area") EXIT FUNCTION END IF OBJECT CALL o_mlApplication.CreateItem(vItemType) TO vMail SET o_mlMailItem = vMail IF ISFALSE ISOBJECT(o_mlMailItem) THEN MSGBOX("Unable to create an email") EXIT FUNCTION END IF vSubject = sSubject$ OBJECT LET o_mlMailItem.Subject = vSubject vBody = sBody$ OBJECT LET o_mlMailItem.Body = vBody IF LEN(TRIM$(sTo$)) = 0 THEN MSGBOX("There is no recipient email address") EXIT FUNCTION END IF vTo = sTo$ OBJECT LET o_mlMailItem.To = vTo IF LEN(TRIM$(sAttachment$)) > 0 THEN vVnt = sAttachment$ OBJECT CALL o_mlMailItem.Attachments.Add(vVnt) END IF IF sMethod$ = "D" THEN OBJECT CALL o_mlMailItem.save ELSEIF sMethod$ = "S" THEN OBJECT CALL o_mlMailItem.send END IF OBJECT CALL o_mlNameSpace.Logoff Terminate: SET o_mlMailItem = NOTHING SET o_mlNameSpace = NOTHING SET o_mlApplication = NOTHING END FUNCTION
Comment