Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
microwin88x
Creator III
Creator III

Error when Sending Mail with Macro?

Hello,

I'm using a Macro in a QlikView application to send a file by mail with gmail specifically.

It works ok when I run it from my desktop, BUT when I try to execute it from the Remote Desktop Connection where we have the server and I get an error in the line objMsg.Send and I don't know what could it be... Because I have Internet connection on the Remote Desktop.

Thank you!

---

Sub SendGMail()

MsgBox "Report Exported Successfully"

filepath="C:\Users\MyUser\Downloads\demo\test.txt"

Set objMsg = CreateObject("CDO.Message")

Set msgConf = CreateObject("CDO.Configuration")

'Server Configuration

msgConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

msgConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"

msgConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25

msgConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1

msgConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "demo@gmail.com"

msgConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "1234567"

msgConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = 1

msgConf.Fields.Update

'End With

objMsg.To = "destination@gmail.com"

objMsg.From = "demo@gmail.com"

objMsg.Subject = "Test Mail"

objMsg.HTMLBody = "QlikView Test Mail"

objMsg.AddAttachment   filepath    ' Attachement

objMsg.Sender = "Mr. Name"

Set objMsg.Configuration = msgConf

' Send

objMsg.Send

Msgbox("Email Sent Successfully")

' Clear

Set objMsg = nothing

Set msgConf = nothing

End Sub

1 Reply
techvarun
Specialist II
Specialist II

Check the below thread.

Not all the macro's will work on server.

macros not working on server