How to send a GMail through IDEAScript

6 posts / 0 new
Last post
Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57
How to send a GMail through IDEAScript

I found this post on the IDEA forums on how to use IDEAScript to send a gmail message. Thought it might be of use to someone.

Sub Main
	Set objMessage = CreateObject("CDO.Message") 
		objMessage.Subject = "Example CDO Message" 
		objMessage.From = "ideasupport@caseware.com" 
		objMessage.To = "oscar.salas@caseware.com" 
		objMessage.TextBody = "New"
		
		objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = "2"
		
		objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.gmail.com"
		
		objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = "465"
		
		objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = "1"
		
		objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = "true"
		
		objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "myemail@caseware.com"
		
		objMessage.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "password1"
		
		objMessage.Configuration.Fields.Update
		
		objMessage.Send
	Set objMessage = Nothing
End Sub

 

Eduardo Espinoza
Offline
Joined: 05/25/2016 - 16:28

Hi Brian, thank you very much for sharing it.

I tried to run it (with my own email and password), but it fails and returns the error shown in the image: 0x80040217.

Do you have any suggestions?

Thanks in advance.

Eduardo

Images: 
Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57
Being that this is over 5 years old things could have changed. The latest version of IDEA 11.2 now handles gmail so if you haven't you should upgrade to the latest version when you can, the English is out, I am not sure when the other languages are being released but it should be soon and then you can use gmail.
Eduardo Espinoza
Offline
Joined: 05/25/2016 - 16:28

Hi Brian, thanks for your answer, I am going to explore it in IDEA 11.2.
Sorry for answering until now!
Thanks again!

Brian Element's picture
Brian Element
Offline
Joined: 07/11/2012 - 19:57

Hi Eduardo, check out the Client.Email in 11.2

Edyn
Offline
Joined: 02/04/2021 - 13:44

Buena tarde, hay una configuracion que debes realizar si se trata de enviar desde Gmail esta en la parte de configuraciones en permisos se debe desactivar para que permita enviar.