Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
HI
I ran into a couple of post regarding automating email reports from Qlik View.
https://qlikpad.com/qlikview-scheduled-reports-sending-excel-via-email/
https://qlikpad.com/qlikview-scheduled-reports-sending-excel-via-email-part-2/
They are a bit old and rely on using ITEMS from ("http://schemas.microsoft.com/cdo/configuration/") and because Microsoft does not support CDO anymore, I have run into a wall of massive misdirecting information on google.
So maybe someone here can help me to figure out how to turn this code, into something that would work with whatever alternative that exists to CDO.
function SendGMail()
Dim objEmail
' Send the message using SMTP
Const cdoSendUsingPort = 2
'Do authenticate
Const cdoAuth = 1
'SMTP server name
Const SMTPServer = "STMPServer"
'SMTP Port
Const SMTPPort = 25
'Gmail User name
Const GmailUser = "USERNAME"
'Gmail password
Const GmailPassword = "PASSWORD"
'Sending mail
Set objEmail = CreateObject("CDO.Message")
Set objConf = objEmail.Configuration
Set objFlds = objConf.Fields
With objFlds
'---------------------------------------------------------------------
' Gmail SMTP server details
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = SMTPServer
.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoAuth
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = SMTPPort
.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = GmailUser
.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = GmailPassword
.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = 1
.Update
'---------------------------------------------------------------------
End WithPlease treat me like I am baby that just found the car keys, and am moving towards the car for a ride.
I am to use some other CDO alternative, how do I replace the ITEMS with this alternative?
Thx guys.
Not sure whats your issue. With small modification of your macro it should work!
sub SendGMail()
Dim objEmail
' Send the message using SMTP
Const cdoSendUsingPort = 2
'Do authenticate
Const cdoAuth = 1
'SMTP server name
Const SMTPServer = "smtp.gmail.com"
'SMTP Port
Const SMTPPort = 465
'Gmail User name
Const GmailUser = "EMAILADDRESS" 'Enter your Emailaddress here
'Gmail password
Const GmailPassword = "PASSWORD" 'Enter your PW here
mailto = "RECEIVEREMAILADDRESS" 'Enter Receiver Emailaddress here
mailSubject = "Subject line" 'Enter Subject here
mailBody = "This is the email body" 'Enter Mailbody here
'Sending mail
Set objEmail = CreateObject("CDO.Message")
Set objConf = objEmail.Configuration
Set objFlds = objConf.Fields
With objFlds
'---------------------------------------------------------------------
' Gmail SMTP server details
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = SMTPServer
.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoAuth
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = SMTPPort
.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = GmailUser
.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = GmailPassword
.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = 1
.Update
'---------------------------------------------------------------------
End With
objEmail.To = mailto
objEmail.From = GmailUser
objEmail.Subject = mailSubject
objEmail.TextBody = mailBody
objEmail.AddAttachment "C:\Users\admin\Desktop\Neues Textdokument.txt" 'Enter Attatchement here
objEmail.Send
Set objFlds = Nothing
Set objConf = Nothing
Set objEmail = Nothing
END SUB
Maybe you could use an approach from the following postings:
Macro-Open-Outlook
Sending-email-from-Qlikview
- Marcus