I have seen a lot of solutions to the problem of putting multiple attachments in a mail message created via codeunit 397.
But or i'm not looking correctly, but i didn't found any:using the 397 codeunit version 3.70,4.00.. (the one with automation.) and putting multiple attachments on it.
Why i'm looking for it?
To finaly have a codeunit where you can:
- use multiple, nice formated body lines (with the function addbodyline)
- use multiple recipients ..
and use multiple attachments...
Rgds
Benny Giebens
0
Comments
IF AttachFileName <> '' THEN BEGIN
BSTRConverterAttachFileName.ResetBSTR;
BSTRConverterAttachFileName.AppendNextStringPortion(AttachFileName);
OAttachments := OSendMail.Attachments;
OAttachment := OAttachments.Add(BSTRConverterAttachFileName);
END;
if checked the functionality with up to 100 attachments.
The solution of the problem is very simple, if you know how.
1) Create a new Function in codeunit 397 identical to the function NewMessage, let's call it "NewMessageMultipleAttachments".
2) Replace the field "AttachFileName" by an array called e.g. "AttachFileNames".
3) Assign number of dimensions you need.
(The calling function must fit with the number of dimensions used here)
4) Modify the part like this 5) At least you have do define and fill up an array in your mail-calling function.
This should work fine
I hope, this tiny little code will help you and others to send multiple attachments from MS Dynamics.
should not communicate his knowledge,
and not believe he knows form hearsay.
BSTRConverterAttachFileName
OAttachments
OSendMail
OAttachment