Add method will add new message to collection of the
messages in the mailbox. Mailbox file will not be updated
itself, until you manually call Update
method.
When you use Add method, wodMailbox will just change
internal indexes to point to file you specified, and
increase total count of messages, if needed.
Add can be also used to add new parts to the message. If
specified message isn't multipart message, wodMailbox
will add appropriate headers to make it multipart, will add
boundary where needed etc..
Returned message object references newly created
message, or newly created part.
You must not violate mail specification for the message
you will add to mailbox/part. It has to be regular message
- it must have headers, one empty line, and text. If there
are no headers - you're doing something wrong, because
wodMailbox will be unable to parse it correctly (it will
loop through message trying to locate any header, and will
fail to do so).
If you're adding new part to the message, and
message wasn't multipart before that, wodMailbox will
add appropriate header (Content-type) and will create a boundary for
you. Your old Message.Text contents will
still be at the same place. New part will be added, and you
will access it with Message.Parts(0).something .
Content-type header that will be added looks like
this:
Content-Type: multipart/mixed;
boundary="----=_NextPart_XXXXXXXX_XXXXXXXX.XXXXXXXX"
where XXXXXXXX are some unique
random numbers. If you need to change Content-type, try to
parse added header properly and replace multipart/mixed
with something else, for example with
multipart/alternative.
If Filename parameter is
omitted, empty message is created.
NOTE: Add method uses temporary file in
temporary folder. There can be problem in ASP environments,
where temporary folder is for IUSR_NAME account is reported
as 'C:\Documents and settings\Default User\'. If
you use this method in such environment, you *must* allow
IUSR_NAME to access and write to this directory.