BOB: Business Objects Board
Not endorsed by or affiliated with SAP

Register | Login 

Want to sponsor BOB? 
Want to sponsor BOB? (Opens a new window)  

General Notice: Upcoming Events: PGHBOUG: Nov 1.

HTML OR PDF IN THE OUTLOOK EMAIL BODY


 
Search this topic... | Search SDK (VBA/ASP/JSP)... | Search Box
Register or Login to Post    Forum Index -> SDK (VBA/ASP/JSP)  Previous TopicPrint TopicNext Topic
Author Message
Ravi_Pazhani
Principal Member
Principal Member



Joined: 20 Aug 2002

Posts: 320
Location: Cingularly I am telling you, I am in a Building...



PostPosted: Wed Dec 27, 2006 5:34 pm 
Post subject: HTML OR PDF IN THE OUTLOOK EMAIL BODY

SDK Gurus,

I am trying to figure it out whether it is possible to embed an html file in the outlook email body instead of an attachment (BO 6.5). I got the VBA code to attach the images such as .GIF files, but not for html or pdf files.


Could someone modify the code to embed the html file? Or if you have done this already, could you make some suggestions?


Here is the code:

Sub HTMLEmbed()
Dim objApp As Outlook.Application
Dim l_Msg As MailItem
Dim colAttach As Outlook.Attachments
Dim l_Attach As Outlook.Attachment
Dim oSession As MAPI.Session

Dim oMsg As MAPI.Message
Dim oAttachs As MAPI.Attachments
Dim oAttach As MAPI.Attachment
Dim colFields As MAPI.Fields
Dim oField As MAPI.Field


Dim strEntryID As String

' create new Outlook MailItem

Set objApp = CreateObject("Outlook.Application")

Set l_Msg = objApp.CreateItem(olMailItem)

Set colAttach = l_Msg.Attachments

Set l_Attach = colAttach.Add("C:\test.gif")

l_Msg.Close olSave

strEntryID = l_Msg.EntryID

Set l_Msg = Nothing

Set colAttach = Nothing

Set l_Attach = Nothing

On Error Resume Next

Set oSession = CreateObject("MAPI.Session")

oSession.Logon "", "", False, False


Set oMsg = oSession.GetMessage(strEntryID)

Set oAttachs = oMsg.Attachments

Set oAttach = oAttachs.Item(1)

Set colFields = oAttach.Fields

Set oField = colFields.Add(CdoPR_ATTACH_MIME_TAG, "html")

Set oField = colFields.Add(&H3712001E, "myident")

oMsg.Fields.Add "{0820060000000000C000000000000046}0x8514", 11, True

oMsg.Update


' get the Outlook MailItem again

Set l_Msg = objApp.GetNamespace("MAPI").GetItemFromID(strEntryID)

' add HTML content -- the <IMG> tag

l_Msg.HTMLBody = "<IMG align=baseline border=0 hspace=0 src=cid:myident>"

l_Msg.Close (olSave)

l_Msg.Display

Set oField = Nothing

Set colFields = Nothing

Set oMsg = Nothing

oSession.Logoff

Set oSession = Nothing

Set objApp = Nothing

Set l_Msg = Nothing

End Sub


Thanks
Ravi.

_________________
Business Intelligence
BO/WebI 6.5/XI, Teradata, Oracle, SQL Server
Back to top
Ravi_Pazhani
Principal Member
Principal Member



Joined: 20 Aug 2002

Posts: 320
Location: Cingularly I am telling you, I am in a Building...



PostPosted: Thu Dec 28, 2006 4:11 pm 
Post subject: Re: HTML OR PDF IN THE OUTLOOK EMAIL BODY

Ok.. Is it possible to save the rep or pdf or html or excel or rtf file as an image file such as .gif or bmp...etc? Please share your inputs.

Thanks
Ravi.

_________________
Business Intelligence
BO/WebI 6.5/XI, Teradata, Oracle, SQL Server
Back to top
mhaberland
Forum Member
Forum Member



Joined: 15 Aug 2002

Posts: 7
Location: Spain


flag
PostPosted: Mon Jan 08, 2007 9:17 am 
Post subject: Re: HTML OR PDF IN THE OUTLOOK EMAIL BODY

Hi
we successfully use Chillkat MHT - a 3rd party tool - in our report refresh and distribution product for 5.x, 6.x and XI - ReportMessenger where we offer your requested feature.

Greetings

_________________
Marc Haberland
ClearPeaks
Back to top
rein08
Forum Member
Forum Member



Joined: 10 Jul 2010

Posts: 3



PostPosted: Wed Jul 14, 2010 11:33 pm 
Post subject: Re: HTML OR PDF IN THE OUTLOOK EMAIL BODY

I have problems too in using my excel.
Please give us tips.
Thanks
Back to top
Titiro
Forum Member
Forum Member



Joined: 16 Aug 2010

Posts: 1



PostPosted: Mon Aug 16, 2010 5:22 pm 
Post subject: Re: HTML OR PDF IN THE OUTLOOK EMAIL BODY

Im using word as my email editor - took me a few searches but found a solution
Code:

Sub Email()
On Error Resume Next
Kill "c:\" & myFilename & ".pdf" 'Remove last instance of file
ThisDocument.ExportAsPDF "c:\" & myFilename & ".pdf" 'Save as PDF
'Create Email
        Set myolapp = CreateObject("Outlook.Application")
        Set mymail = myolapp.CreateItem(olmailitem)
        mymail.Subject = "Subject in here"
        mymail.to = "email in here" ' Team Leader Email
        mymail.Attachments.Add ("C:\" & myFilename & ".pdf"), olole 'Attach PDF File
        mymail.display
        'Embed PDF
        wordapp.Visible = True
        Set wordapp = GetObject(, "Word.Application")
        wordapp.selection.InlineShapes.AddOLEObject ClassType:="AcroExch.Document.7", _
        Filename:="c:\" & myFilename & ".pdf", LinkToFile:=False, _
        DisplayAsIcon:=False
End Sub
Back to top
Display posts from previous:   
Register or Login to Post    Forum Index -> SDK (VBA/ASP/JSP)  Previous TopicPrint TopicNext Topic
Page 1 of 1 All times are GMT - 5 Hours
 
Jump to:  

Index | About | FAQ | RAG | Privacy | Search |  Register |  Login 

Get community updates via Twitter:

Not endorsed by or affiliated with SAP
Powered by phpBB © phpBB Group
Generated in 0.0276 seconds using 17 queries. (SQL 0.0022 Parse 0.0009 Other 0.0246)
CCBot/2.0 (https://commoncrawl.org/faq/)
Hosted by ForumTopics.com | Terms of Service
phpBB Customizations by the phpBBDoctor.com
Shameless plug for MomentsOfLight.com Moments of Light Logo