Attachments and the mail Body 
Author Message
 Attachments and the mail Body

There is no programmatic relationship. However, in the user interface, if
the message is in RTF format, the attachment icon will appear within the
message body.

You might want to post the relevant snippet of code so other people can try
to duplicate your problem.

--
Sue Mosher, Outlook MVP
Author of
     Teach Yourself Microsoft Outlook 2000 Programming in 24 Hours
     Microsoft Outlook 2000 E-mail and Fax Guide
Outlook and Exchange solutions at http://www.*-*-*.com/


Quote:
> What is the relation between attachments and a mail's body, and how does
it
> differ depending on whether you are replying to a mail or creating a new
> mail?

> For example, if you create a new mail and attach a file it will be
embedded
> in the mail dialog itself. However, if you reply to a message, the
> attachment is added in a separate pane at the base of the dialog.

> I have a macro which tests a mail for the presence of attachments, and if
> one if found I modify the body slightly. However, whenever this macro runs
> when replying to a mail with an attachment, my new attachment is deleted
> when the mail's Body property is modified. However, it works fine under
> other conditions such as a new mail.

> This is driving me crazy as there's no way to find out what's happening.
Any
> ideas anyone?



Sat, 07 Jun 2003 02:58:01 GMT  
 Attachments and the mail Body

Try the Inspector.EditorType property.

--
Sue Mosher, Outlook MVP
Author of
     Teach Yourself Microsoft Outlook 2000 Programming in 24 Hours
     Microsoft Outlook 2000 E-mail and Fax Guide
Outlook and Exchange solutions at http://www.slipstick.com


Quote:
> That sounds like it could be the problem. Can you programatically
> differentiate between a Rich Text and a Plain Text message - I can't see
any
> obvious way to do it.

> My code looks some thing like this:

> Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)

>     Dim ThisMail As MailItem
>     Dim strAttachment As String

>     strAttachment = "The sender cannot accept any liability for any loss "
&
> _
>                     "or damage sustained as a result of software viruses.
"
> & _
>                     "It is your responsibility to carry out such virus " &
_
>                     "checking as is necessary before opening any
> attachment."

>     If Item.Class <> olMail Then Exit Sub

>     Set ThisMail = Item

>     If ThisMail.Attachments.Count > 0 Then
>         ThisMail.Body = ThisMail.Body & vbCrLf & strAttachment
>     End If

>     Set ThisMail = Nothing

> End Sub

> With a Plain text message, whenever the ThisMail.Body = xxx is set, the
> attachment is deleted.



> > There is no programmatic relationship. However, in the user interface,
if
> > the message is in RTF format, the attachment icon will appear within the
> > message body.

> > You might want to post the relevant snippet of code so other people can
> try
> > to duplicate your problem.



> > > What is the relation between attachments and a mail's body, and how
does
> > it
> > > differ depending on whether you are replying to a mail or creating a
new
> > > mail?

> > > For example, if you create a new mail and attach a file it will be
> > embedded
> > > in the mail dialog itself. However, if you reply to a message, the
> > > attachment is added in a separate pane at the base of the dialog.

> > > I have a macro which tests a mail for the presence of attachments, and
> if
> > > one if found I modify the body slightly. However, whenever this macro
> runs
> > > when replying to a mail with an attachment, my new attachment is
deleted
> > > when the mail's Body property is modified. However, it works fine
under
> > > other conditions such as a new mail.

> > > This is driving me crazy as there's no way to find out what's
happening.
> > Any
> > > ideas anyone?



Mon, 09 Jun 2003 00:10:09 GMT  
 Attachments and the mail Body
I'm now confused. Replying to a message never includes the attachment from
the original message. Can you explain the entire issue again, based on your
new insignts?
--
Sue Mosher, Outlook MVP
Author of
     Teach Yourself Microsoft Outlook 2000 Programming in 24 Hours
     Microsoft Outlook 2000 E-mail and Fax Guide
Outlook and Exchange solutions at http://www.slipstick.com


Quote:
> Ok, after some further exploration I have now determined that the problem
> only occurs if you are replying to a Plain text mail that had an
attachment
> added to it.

> I'm guessing it might be something to do with the way a previous
attachment
> is indicated as <<File: XXX>>. For example, if you simply set the Body of
> the replying mail to "" then you still see the references to the
previously
> attached files but you lose any attachment that you yourself added.



> > Try the Inspector.EditorType property.



> > > That sounds like it could be the problem. Can you programatically
> > > differentiate between a Rich Text and a Plain Text message - I can't
see
> > any
> > > obvious way to do it.

> > > My code looks some thing like this:

> > > Private Sub Application_ItemSend(ByVal Item As Object, Cancel As
> Boolean)

> > >     Dim ThisMail As MailItem
> > >     Dim strAttachment As String

> > >     strAttachment = "The sender cannot accept any liability for any
loss
> "
> > &
> > > _
> > >                     "or damage sustained as a result of software
> viruses.
> > "
> > > & _
> > >                     "It is your responsibility to carry out such virus
"
> &
> > _
> > >                     "checking as is necessary before opening any
> > > attachment."

> > >     If Item.Class <> olMail Then Exit Sub

> > >     Set ThisMail = Item

> > >     If ThisMail.Attachments.Count > 0 Then
> > >         ThisMail.Body = ThisMail.Body & vbCrLf & strAttachment
> > >     End If

> > >     Set ThisMail = Nothing

> > > End Sub

> > > With a Plain text message, whenever the ThisMail.Body = xxx is set,
the
> > > attachment is deleted.



> > > > There is no programmatic relationship. However, in the user
interface,
> > if
> > > > the message is in RTF format, the attachment icon will appear within
> the
> > > > message body.

> > > > You might want to post the relevant snippet of code so other people
> can
> > > try
> > > > to duplicate your problem.



> > > > > What is the relation between attachments and a mail's body, and
how
> > does
> > > > it
> > > > > differ depending on whether you are replying to a mail or creating
a
> > new
> > > > > mail?

> > > > > For example, if you create a new mail and attach a file it will be
> > > > embedded
> > > > > in the mail dialog itself. However, if you reply to a message, the
> > > > > attachment is added in a separate pane at the base of the dialog.

> > > > > I have a macro which tests a mail for the presence of attachments,
> and
> > > if
> > > > > one if found I modify the body slightly. However, whenever this
> macro
> > > runs
> > > > > when replying to a mail with an attachment, my new attachment is
> > deleted
> > > > > when the mail's Body property is modified. However, it works fine
> > under
> > > > > other conditions such as a new mail.

> > > > > This is driving me crazy as there's no way to find out what's
> > happening.
> > > > Any
> > > > > ideas anyone?



Tue, 10 Jun 2003 01:26:21 GMT  
 Attachments and the mail Body
Understood. Thanks. I haven't been able to duplicate the problem, though. If
you send one of these replies to yourself, what do you see when you choose
File | Save Attachments?

--
Sue Mosher, Outlook MVP
Author of
     Teach Yourself Microsoft Outlook 2000 Programming in 24 Hours
     Microsoft Outlook 2000 E-mail and Fax Guide
Outlook and Exchange solutions at http://www.slipstick.com


Quote:
> OK, here it goes.

> Person A sends a mail to me using a Plain Text format with a file
attached.

> I want to reply to their mail and add an attachment of my own.

> I also want to write a macro that add a line of text automatically to any
> mail I send out that has an attachment. I do this by modifying the
> MailItem.Body property.

> Whenever the MailItem.Body of a Plain Text mail with an attachment is
> modified the new attachment I want to send is removed.



> > I'm now confused. Replying to a message never includes the attachment
from
> > the original message. Can you explain the entire issue again, based on
> your
> > new insignts?



> > > Ok, after some further exploration I have now determined that the
> problem
> > > only occurs if you are replying to a Plain text mail that had an
> > attachment
> > > added to it.

> > > I'm guessing it might be something to do with the way a previous
> > attachment
> > > is indicated as <<File: XXX>>. For example, if you simply set the Body
> of
> > > the replying mail to "" then you still see the references to the
> > previously
> > > attached files but you lose any attachment that you yourself added.



> > > > > That sounds like it could be the problem. Can you programatically
> > > > > differentiate between a Rich Text and a Plain Text message - I
can't
> > see
> > > > any
> > > > > obvious way to do it.

> > > > > My code looks some thing like this:

> > > > > Private Sub Application_ItemSend(ByVal Item As Object, Cancel As
> > > Boolean)

> > > > >     Dim ThisMail As MailItem
> > > > >     Dim strAttachment As String

> > > > >     strAttachment = "The sender cannot accept any liability for
any
> > loss
> > > "
> > > > &
> > > > > _
> > > > >                     "or damage sustained as a result of software
> > > viruses.
> > > > "
> > > > > & _
> > > > >                     "It is your responsibility to carry out such
> virus
> > "
> > > &
> > > > _
> > > > >                     "checking as is necessary before opening any
> > > > > attachment."

> > > > >     If Item.Class <> olMail Then Exit Sub

> > > > >     Set ThisMail = Item

> > > > >     If ThisMail.Attachments.Count > 0 Then
> > > > >         ThisMail.Body = ThisMail.Body & vbCrLf & strAttachment
> > > > >     End If

> > > > >     Set ThisMail = Nothing

> > > > > End Sub

> > > > > With a Plain text message, whenever the ThisMail.Body = xxx is
set,
> > the
> > > > > attachment is deleted.



> > > > > > There is no programmatic relationship. However, in the user
> > interface,
> > > > if
> > > > > > the message is in RTF format, the attachment icon will appear
> within
> > > the
> > > > > > message body.

> > > > > > You might want to post the relevant snippet of code so other
> people
> > > can
> > > > > try
> > > > > > to duplicate your problem.



> > > > > > > What is the relation between attachments and a mail's body,
and
> > how
> > > > does
> > > > > > it
> > > > > > > differ depending on whether you are replying to a mail or
> creating
> > a
> > > > new
> > > > > > > mail?

> > > > > > > For example, if you create a new mail and attach a file it
will
> be
> > > > > > embedded
> > > > > > > in the mail dialog itself. However, if you reply to a message,
> the
> > > > > > > attachment is added in a separate pane at the base of the
> dialog.

> > > > > > > I have a macro which tests a mail for the presence of
> attachments,
> > > and
> > > > > if
> > > > > > > one if found I modify the body slightly. However, whenever
this
> > > macro
> > > > > runs
> > > > > > > when replying to a mail with an attachment, my new attachment
is
> > > > deleted
> > > > > > > when the mail's Body property is modified. However, it works
> fine
> > > > under
> > > > > > > other conditions such as a new mail.

> > > > > > > This is driving me crazy as there's no way to find out what's
> > > > happening.
> > > > > > Any
> > > > > > > ideas anyone?



Mon, 16 Jun 2003 21:52:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Q: Attachment: How to insert filename of attachment in message body

2. Attachments for e-mail in mail merge

3. vbCrLf after attachment - (not '.Body')

4. Body Layout with an Attachment

5. Retrieving attachments and body from .msg files using a standalone application

6. Html attachment visible in mailitem body

7. Inserting attachments in body for RTF format.

8. Retrieve HTML body from attachment

9. Attachment in body of message

10. Saving Body Text From Attachments

11. Saving Item.body and item.attachment

12. HTML attachment displayed in message body in MS Outlook

 

 
Powered by phpBB® Forum Software