I was hoping that some of the more tech savvy members would be able to assist or point me in the right direction.
I want to be able to send an email with a .pdf report attached to a selection of users on a daily basis. I have developed the Qlikview app that writes out the .pdf and can mail the report from my desktop version when not linked to the company network. I got the code from the forum. It uses the gmail smtp server to send the mail.
Once I try to run Qlikview from our warehouse server it returns the message 'The transport failed to connect to the server'. When running on the company server I use the company SMTP server and not the gmail server.
What is strange is that I can send an email using Powershell. I use the same parameters in my Qlikview model as Powershell. I have worked with our sever engineer to try to get it to work without success. It seems to me to be a setting on the server/virus protection/mail server. In order to get the mail to send they setup the mail server to allow it to relay messages. The code below is what I use.
Const cdoSendUsingPort = 2 ' Send the message using SMTP
Const cdoBasicAuth = 1 ' Clear-text authentication Const
cdoTimeout = 60 ' Timeout for SMTP in seconds
mailServer = "relay.enterpriseoutsourcing.co.za"
SMTPport = 25
mailusername = "Qlikview@universal.co.za"
mailpassword = ""
mailto = "firstname.lastname@example.org; Braham.Edwards@universal.co.za"
mailSubject = "Report 01"
mailBody = "This is the email body"
Set objEmail = CreateObject("CDO.Message")
Set objConf = objEmail.Configuration
Set objFlds = objConf.Fields
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = mailServer
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = SMTPport
.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = cdoTimeout
.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasicAuth
.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = mailusername
.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = mailpassword
objEmail.To = mailto
objEmail.From = mailusername
objEmail.Subject = mailSubject
objEmail.TextBody = mailBody
objEmail.AddAttachment "C:\QlikView Printing.pdf"
Set objFlds = Nothing
Set objConf = Nothing
Set objEmail = Nothing
The sending fails on the objEmail.Send statement
Some input would be appreciated, especially if some advise on possible server settings that need to be enabled.