Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
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
Clever_Anjos
Employee
Employee

Please check if there´s a firewall blocking access to port 25