Keep Original html body when forwarding an email

Status
Not open for further replies.

DAVID POWELL

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
This code is wiping out my original mail with text and html
I want to retain the original message and just add something at the top ?

add this : "This is Rejected"


Sub CommandButton6_click()

ChangeSubjectForward Item

End sub

Sub ChangeSubjectForward(Item)
Item.Subject = "Test"
Set myForward = Item.Forward
myForward.Recipients.Add "ccccc.ccccell@somewhere.com"
myForward.Body = "This is Rejected"
Item.Save
myForward.Send
End Sub

Thanks
david powell
 

DAVID POWELL

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
Sub ChangeSubjectForward(Item)
Item.Subject = "Test"
Set myForward = Item.Forward
myForward.Recipients.Add "test@domain.com"
myForward.HTMLBody = "This is Rejected" & myForward.htmlbody
myForward.Send
End Sub

This seems to work
is there another way ?

Thanks
David Powell
 
Last edited by a moderator:

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
That is the easiest, most efficient way... you could use word vba to insert text before - an example code is here - Add Attachment Names to Message Before Sending

it's an additional 10 lines - i would probably only use it in your situation if the html body gets messed by the additional code. if you need an extra line between the text and the original body, try using either html tags or adding vbcrlf.
 

DAVID POWELL

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
Diane,
Actually yes, i'm needing an extra line after:
myForward.HTMLBody = "This is Rejected" & myForward.htmlbody

Because I want it to read:

This is rejected

Blah blah blah blah

html stuff
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
Try using
myForward.HTMLBody = "<p>This is Rejected</p>" & myForward.HTMLBody

The sample with more space used the p tags, the top one is using your initial code. Using 2 <br /> tags is the same as using the p tags:
myForward.HTMLBody = "This is Rejected <br /><br />" & myForward.HTMLBody
samples.png
 

Diane Poremsky

Senior Member
Outlook version
Outlook 2016 32 bit
Email Account
Office 365 Exchange
BTW, you can use html styles too - just use single quote, not double, with style:
myForward.HTMLBody = "<p style='color:red; font-size:18pt'>This is Rejected. </p><p>Try again. </p>" & myForward.HTMLBody
sample-2.png
 

DAVID POWELL

Senior Member
Outlook version
Outlook 2010 32 bit
Email Account
Exchange Server
this worked:
eBody = "I Have Reviewed and Approved the following pricing escalation." & "<br>" _
& "Please Review the Request and advise if you support the links below." & "<br>" _
& myForward.HTMLBody


Thanks for direction
dp
 
Status
Not open for further replies.
Top