Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Macro for sending mail through Gmail

Hi Everyone,

I am using this Macro for sending Mail through Gmail Account. But there is some issues in this.It get stopped at objmail.send.

Can anyone help me in this ?

Dim objEmail

Const cdoSendUsingPort = 2

Const cdoAnonymous = 0

Const cdoBasic = 1

Const cdoNTLM = 2

Const SMTPServer = "smtp.gmail.com"

Const SMTPPort = 465

Const SMTPTimeout = 60

Const user = "mygmailaccount"

Const psw = "mypassword"



Set objEmail = CreateObject("CDO.Message")

Set objConf = objEmail.Configuration

Set objFlds = objConf.Fields

With objFlds

'---------------------------------------------------------------------

' SMTP server details

.Item("schemas.microsoft.com/.../sendusing") = cdoSendUsingPort

.Item("schemas.microsoft.com/.../smtpserver") = SMTPServer

.Item("schemas.microsoft.com/.../smtpauthenticate") = codBasic

.Item("schemas.microsoft.com/.../sendpassword")= psw

.Item("schemas.microsoft.com/.../sendusername")= user

.Item("schemas.microsoft.com/.../smtpserverport") = SMTPPort

.Item("schemas.microsoft.com/.../smtpusessl") = True

.Item("schemas.microsoft.com/.../smtpconnectiontimeout") = SMTPTimeout

.Update

'---------------------------------------------------------------------

End With


objEmail.To = "toaccountemailid"

objEmail.From = "fromaccountemailid"

objEmail.Subject = "test"

objEmail.TextBody = "message de test"

objEmail.Send

Set objFlds = Nothing

Set objConf = Nothing

Set objEmail = Nothing

6 Replies
danielrozental
Master II
Master II

Gmail uses SSL, I believe you would need something like STUNNEL to make it work.

Not applicable
Author

I have the same problem

Not applicable
Author

anyone can help us ,I am too facing the same issue

m_woolf
Master II
Master II

Just a thought:

If you set up outlook for the gmail accoount, you should be able to use code for sending mail with outlook.

Miguel_Angel_Baeyens

Hi,

Please check the code in this thread, that has been tested and works fine.

Hope that helps.

Miguel

Not applicable
Author

Hi Miguel

IT worked it out, I much thanks for your Assistance