Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Qlikview Macro code to send a Email

Hi All,


While using the below code i can able to send a e-mail from Qlikview.


Here i'm trying to do more modifications like now in mail i want to add some body content & signature for the e-mail.


While using the below marco code i can able to achieve the Blue code stuff.. but i'm not able to achieve the red code stuff ..

Help on this..


Qlikview Macro Code:

sub mSendMail

          Dim objOutlk 'Outlook

          Dim objMail 'Email item

          Dim strMsg

          dim strMailTo

          dim sString

          dim oldFormat

          Dim Rng

          Const olMailItem = 0

          Const CdoReferenceTypeName = 1

          Set objOutlk = CreateObject("Outlook.Application")

          Set objMail = objOutlk.createitem(olMailItem)

          Set Rng = Nothing

          objMail.To = "abc@xyz.com"       

          objMail.subject = "Today Dashboard" & Date()

          ActiveDocument.ActiveSheet.CopyBitmapToClipboard true

          ActiveDocument.GetSheetObject("CH86").ExportBitmapToFile "C:\User\Dashobard.jpeg"

          objMail.attachments.add("C:\User\Dashobard.jpeg")

          objMail.body ="Please find the Today Dashboard"   

     strMsg = "This is an automatic generated email from QlikView for Dashobard."

          objMail.body = strMsg

          objMail.HTMLBODY = "<HTML><BODY><img align=baseline border=0 hspace=10 src='cid:C:\User\Dashobard.jpeg'</BODY></HTML>"

            objMail.Send

          Set objMail = Nothing

          Set objOutlk = Nothing

    'Msgbox " Mail delivered"

end sub


Expected output in the E-mail


To:abc@xyz.com

CC:cdf@xyz.com

Subject: todays dashboard.


E-mail body : Hi, Please find the todays dashboard in the attachments.


IMAGE


Email-Signature
Thanks & Regards,

Venkata Sreekanth

11 Replies
INRHA
Contributor
Contributor

It is a very old post but I hope it helps someone, this syntax work for me:

objMail.HTMLBODY = "<HTML><BODY><p align='CENTER'><img src='C:\User\Dashobard.jpeg' width=600 height=450 border=0><br></p></BODY></HTML>"

All the body must be in HTML code so remove objMail.body

olaoyesunday1
Contributor III
Contributor III

Please, How did you set up Outlook SMTP in your QlikView?