Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

BARC’s The BI Survey 19 makes it official. BI users love Qlik. GET REPORT
Contributor III

Error when sending mail with macro?


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"


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


'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


Msgbox("Email Sent Successfully")

' Clear

Set objMsg = nothing

Set msgConf = nothing

End Sub

Tags (2)
1 Reply

Re: Error when sending mail with macro?

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