Gmail is removing the ability to send emails through third-party apps (it seems like it's already been done in several countries, and will happen on May 30 in the US where I am):
https://support.google.com/accounts/answer/6010255?hl=en
I think this means that we will lose the ability to send email through gmail using the CDO COM method described by
@jack dunning here:
viewtopic.php?f=6&t=71493&hilit=send+email
@Joe Glines here:
https://www.the-automator.com/downloads/emailsender/
@JoeWinograd here:
viewtopic.php?f=76&t=67283
I think it may still work if you use an app password (as explained in Joe Glines' video), but that will require 2-factor authorization, which is a no go for my situation.
So I'm looking at alternative ways to send email through AHK. Has anyone used the CDO COM method with something other than gmail? Does the method described by Joe Winograd require an Office 365 account? Are there other ways to do this?
Thanks in advance for any help you may be able to provide.
Losing ability to send email through gmail?
Re: Losing ability to send email through gmail?
With Office 365, you can automate sending emails via the COM interface with Outlook if you have your gmail account linked to Outlook.
Re: Losing ability to send email through gmail?
Thanks @boiler for the reply.
Are you talking about the Office 365 desktop programs or about Office 365 online? I'm guessing you are talking about the programs. So would that mean that Outlook 365 would nee to be installed on each computer that uses the script? Unfortunately, since the script is used by many users, this would not be possible.
Are you talking about the Office 365 desktop programs or about Office 365 online? I'm guessing you are talking about the programs. So would that mean that Outlook 365 would nee to be installed on each computer that uses the script? Unfortunately, since the script is used by many users, this would not be possible.
Re: Losing ability to send email through gmail?
Yes, as far as I know, it would need to be installed.
- flyingDman
- Posts: 2840
- Joined: 29 Sep 2013, 19:01
Re: Losing ability to send email through gmail?
I have the "app password" (see here: https://support.google.com/accounts/answer/185833?hl=en) and it works just fine.but that will require 2-factor authorization, which is a no go for my situation.
14.3 & 1.3.7
Re: Losing ability to send email through gmail?
@flyingDman would you be so kind as to put in a sample code with the app password (using ComObjCreate("CDO.Message"), and how to get this app password generated via Gmail?flyingDman wrote: ↑07 Apr 2022, 12:53I have the "app password" (see here: https://support.google.com/accounts/answer/185833?hl=en) and it works just fine.but that will require 2-factor authorization, which is a no go for my situation.
Re: Losing ability to send email through gmail?
@JoeWinograd I have a problem using powershell to send emails from some PCs. It sends fine on some and does not work on others. I wonder if you have a solution or perhaps someone is using the CDO method with outlook accounts.labrint wrote: ↑08 Apr 2022, 03:23@flyingDman would you be so kind as to put in a sample code with the app password (using ComObjCreate("CDO.Message"), and how to get this app password generated via Gmail?flyingDman wrote: ↑07 Apr 2022, 12:53I have the "app password" (see here: https://support.google.com/accounts/answer/185833?hl=en) and it works just fine.but that will require 2-factor authorization, which is a no go for my situation.
Re: Losing ability to send email through gmail?
Nothing to worry about guys.
I set up two factor authentication by;
a) going to google account
b) logging in
c) go to security settings https://myaccount.google.com/security
d) switch on two factor authentication
e) go back to security settings
f) go to under App Passwords "Signing in to Google"
g) generate a new password for windows
h) copy the password
i) replace the password in your app with the new password generated
I set up two factor authentication by;
a) going to google account
b) logging in
c) go to security settings https://myaccount.google.com/security
d) switch on two factor authentication
e) go back to security settings
f) go to under App Passwords "Signing in to Google"
g) generate a new password for windows
h) copy the password
i) replace the password in your app with the new password generated
- flyingDman
- Posts: 2840
- Joined: 29 Sep 2013, 19:01
Re: Losing ability to send email through gmail?
@labrint I guess you got it. The app password replaces the regular password in the script. My script is not different than others you listed above (though ports and servers might be different). Just in case, here it goes:
Code: Select all
rcpnts := "john.doe@xmail.com, john@gmx.com"
fileappend,This is a test`n,attachment.txt
pmsg := ComObjCreate("CDO.Message")
pmsg.From := """Jane Doe"" <jane.doe@xmail.com>"
pmsg.To := rcpnts
pmsg.BCC := "" ; Blind Carbon Copy, Invisible for all, same syntax as CC
pmsg.CC := "" ; Somebody@somewhere.com, Other-somebody@somewhere.com
pmsg.Subject := "See attached"
;pmsg.TextBody := "I thought you might be interested in attached document"
pmsg.HtmlBody := "<html><body><table border='1'><tr><td>row 1, cell 1</td><td>row 1, cell 2</td></tr><tr><td>row 2, cell 1</td><td>row 2, cell 2</td></tr></table> </body></html>"
sAttach := a_scriptdir "\attachment.txt" ; can add multiple attachments, the delimiter is |
fields := Object()
fields.smtpserver := "smtp.gmail.com" ; specify your SMTP server
fields.smtpserverport := 465 ; 25
fields.smtpusessl := True ; False
fields.sendusing := 2 ; cdoSendUsingPort
fields.smtpauthenticate := 1 ; cdoBasic
fields.sendusername := "Jane.doe@xmail.com"
fields.sendpassword := "abcd efgh klmn qwer" ; app password
fields.smtpconnectiontimeout := 60
schema := "http://schemas.microsoft.com/cdo/configuration/"
pfld := pmsg.Configuration.Fields
For field,value in fields
pfld.Item(schema . field) := value
pfld.Update()
Loop, Parse, sAttach, |, %A_Space%%A_Tab%
pmsg.AddAttachment(A_LoopField)
pmsg.Send()
filedelete,attachment.txt
return
14.3 & 1.3.7
Re: Losing ability to send email through gmail?
Today I use BLAT.exe - has worked perfectly for many years. But is a bit tricky to install and handle (and the future is a bit uncertain).
I have tested Thunderbird (Command line arguments)
an example .: thunderbird.exe -compose "to='email@domain.com',subject='Some Subject',preselectid='id1',body='Message Body',attachment='File.txt'" ( from Thunderbird compose email in a batch script )
I failed to automatically send an email (through Thunderbird)
Is it possibly?
I have tested Thunderbird (Command line arguments)
an example .: thunderbird.exe -compose "to='email@domain.com',subject='Some Subject',preselectid='id1',body='Message Body',attachment='File.txt'" ( from Thunderbird compose email in a batch script )
I failed to automatically send an email (through Thunderbird)
Is it possibly?
- JoeWinograd
- Posts: 2213
- Joined: 10 Feb 2014, 20:00
- Location: U.S. Central Time Zone
Re: Losing ability to send email through gmail?
I'm not a PowerShell expert...I have only two thoughts on this re the computers where it does not work:labrint wrote:It sends fine on some and does not work on others
(1) The PATH variable may not have the location of the PowerShell executable in it, in which case you could either add it to the PATH or use the full path to it in your code.
(2) The PowerShell execution policy may be preventing the PowerShell code from running. PowerShell has four execution policies:
Restricted: No scripts can be run. Windows PowerShell can be used only in interactive mode.
AllSigned: Only scripts signed by a trusted publisher can be run.
RemoteSigned: Downloaded scripts must be signed by a trusted publisher before they can be run.
Unrestricted: No restrictions - all scripts can be run.
If this is the issue, either change the execution policy on the system to one that allows the code to run or put the execution policy (or a bypass) in your code. Regards, Joe
Who is online
Users browsing this forum: Bing [Bot], Google [Bot], Marium0505, Rohwedder and 143 guests