Skip to main content

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 Fri, 11/06/2020 - 16:24

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

Brian Element Fri, 11/06/2020 - 17:07
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 Wed, 12/16/2020 - 19:19

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

Edyn Thu, 12/30/2021 - 13:05

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.