Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Script for Exporting and Sending email

Hi Everybody,

Please help me the script to export the Qlikview documents into Excell/PDF file and the script to send email in Qlikview environment.

Many thanks,

Tai.

85 Replies
Not applicable
Author

The IP-address you provided as SMTP-server is a Gmail-mailserver, I'm afraid they do not allow this (not sure about it).

Do you have an internal mailserver which is allowing relaying from the IP of the Qlikview-machine ?

Not applicable
Author

yes. i will try with that and update you..

Also i am using an win7 and qlikview 11 , both of them are 64 bit. Does that make any issues?

Not applicable
Author

Hi,

for working the mail attachment by written you says, the os and qlikview be of 32 bit. I am having a win7 and qlikview 11 , both of them are 64 bit and i was not yet successfully done it.

Not applicable
Author

We are still on v10 ...

I haven't tried v11 yet

Not applicable
Author

I'm using this code for Exchange mail, v11, Win7, 64bit

and it works fine!


function zendDagrapport(AttachmentPath)

          Dim objEmail

          Const cdoSendUsingPort = 2 ' Send the message using SMTP

          Const cdoAnonymous = 0 'Do not authenticate

          Const cdoBasic = 1 'basic (clear-text) authentication

          Const cdoNTLM = 2 'NTLM

          SMTPServer = "Your Server IP"

          Const SMTPPort = 25 ' Port number for SMTP

          Const SMTPTimeout = 120 ' Timeout for SMTP in seconds

          'Sending mail

          Set objEmail = CreateObject("CDO.Message")

          Set objConf = objEmail.Configuration

          Set objFlds = objConf.Fields

          With objFlds

          '---------------------------------------------------------------------

          ' SMTP server details

          .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort

          .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = SMTPServer

          .Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic

          .Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "Your UserName"

          .Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "Password"

          .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = SMTPPort

          .Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False

          .Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = SMTPTimeout

          .Update

          '---------------------------------------------------------------------

          End With

          objEmail.To = "To Mail" 'Email Recipient

          objEmail.From = "From Mail" 'Email Sender

          objEmail.Subject = "Mail Subject" ' Subject

          objEmail.TextBody = "Mail Body" 'Text Body

          objEmail.AddAttachment AttachmentPath  'Attachement

          objEmail.Send

          Set objFlds = Nothing

          Set objConf = Nothing

          Set objEmail = Nothing

          ' msgbox ("Test Mail Sent")

end function

Not applicable
Author

v10 needs to be of 32 bit to work the macro written by you?

Not applicable
Author

Indeed, the send-function works.  The PDF-creation has troubles with 64bit (in my script)

Not applicable
Author

Hi, does it work with gmail smtp server..?

Not applicable
Author

I think i did little change in you script, and it works now in 64bit

FUNCTION MyPrintPDFWithBullZip (pdfOutputFile)

          set obj = CreateObject("Bullzip.PdfSettings")

          obj.PrinterName = "Bullzip PDF Printer"

          obj.SetValue "Output" , pdfOutputFile

          obj.SetValue "ConfirmOverwrite", "no"

          obj.SetValue "ShowSaveAS", "never"

          obj.SetValue "ShowSettings", "never"

          obj.SetValue "ShowPDF", "no"

          obj.SetValue "RememberLastFileName", "no"

          obj.SetValue "RememberLastFolderName", "no"

          obj.SetValue "ShowProgressFinished", "no"

          obj.SetValue "ShowProgress", "no"

          obj.WriteSettings True

END FUNCTION

Not applicable
Author

Hi we have a internal mail server as

mail.mcn.com

do i give this here

SMTPServer = "Your Server IP" (mail.mcn.com)