Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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