Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

sending mail via QV

Hi,

Is it possible to send a mail,when the qvw file is reloaded?

Thanks in advance

1 Solution

Accepted Solutions
krishna20
Specialist II
Specialist II

HI ,

Please find the below code in macros.It may helpful

  1. Sub SendGMail()  
  2.  
  3. ' Object creation  
  4. Set objMsg = CreateObject("CDO.Message")  
  5. Set msgConf = CreateObject("CDO.Configuration")  
  6.  
  7. ' Server Configuration  
  8. msgConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2  
  9. msgConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"  
  10. msgConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465  
  11. msgConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1  
  12. msgConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "user@gmail.com"  
  13. msgConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "password"  
  14. msgConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = 1  
  15. msgConf.Fields.Update  
  16.  
  17. ' Email  
  18. objMsg.To = "user@gmail.com"  
  19. objMsg.From = "fromuser@domain.com"  
  20. objMsg.Subject = "Test send with Gmail account"  
  21. objMsg.HTMLBody = "HTML/Plain text message."  
  22. objMsg.Sender = "Mr. Name"  
  23.  
  24. Set objMsg.Configuration = msgConf  
  25.  
  26. ' Send  
  27. objMsg.Send  
  28.  
  29. ' Clear  
  30. Set objMsg = nothing  
  31. Set msgConf = nothing 
  32.  
  33. End Sub 

Regards

Krishna

View solution in original post

4 Replies
Anonymous
Not applicable
Author

Hi,

Yes, it is possible.

In the main menu, go to Tools-Alerts and there you can set various options for sending an email/alert.

Hope this helps!

krishna20
Specialist II
Specialist II

HI ,

Please find the below code in macros.It may helpful

  1. Sub SendGMail()  
  2.  
  3. ' Object creation  
  4. Set objMsg = CreateObject("CDO.Message")  
  5. Set msgConf = CreateObject("CDO.Configuration")  
  6.  
  7. ' Server Configuration  
  8. msgConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2  
  9. msgConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"  
  10. msgConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465  
  11. msgConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1  
  12. msgConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "user@gmail.com"  
  13. msgConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "password"  
  14. msgConf.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = 1  
  15. msgConf.Fields.Update  
  16.  
  17. ' Email  
  18. objMsg.To = "user@gmail.com"  
  19. objMsg.From = "fromuser@domain.com"  
  20. objMsg.Subject = "Test send with Gmail account"  
  21. objMsg.HTMLBody = "HTML/Plain text message."  
  22. objMsg.Sender = "Mr. Name"  
  23.  
  24. Set objMsg.Configuration = msgConf  
  25.  
  26. ' Send  
  27. objMsg.Send  
  28.  
  29. ' Clear  
  30. Set objMsg = nothing  
  31. Set msgConf = nothing 
  32.  
  33. End Sub 

Regards

Krishna

Not applicable
Author

Helpful post!

alexantone
Creator
Creator

A very good altenative of sending alert /mail

However you must allowed scripting on Qlikview Server