Author |
|
GadgetGuy Super User
Joined: June 01 2008 Location: United States
Online Status: Offline Posts: 942
|
Posted: July 13 2022 at 09:10 | IP Logged
|
|
|
After a total crash and disk corruption a month ago I am almost finished rebuilding and testing PH. Probably have it in the best and most tested cofiguration I have had in close to 30 years. (OMG hard to believe it has been operating our homes for that long but started in ~1991!)
Anyway just discovered that none of my motion sensor low battery emails alerts have been working. I can get NONE of the various ph send smptemail functions to work. All give me an error of "8" when test executed in the Formula Builder window.
I'm using the ph_sendsmptemail() function and find the previous formulas, that worked for years, no longer do.... and nothing I can do with them makes them work.
Per a forum suggestion I have just tried the ph_sendsmtppemailasync() function since it can trace results.
This is my formula...
and here are the ACph_getmtret(), ph_getlasterror(), ph_getlasterrorstring() returns respectively...
Interesting that the Formula Builder window "Check Formula" results in a Return Code of "0", but the ...async() error returns do not match up.
I am operating in a Windows 10-Home environment with the MS Default Mail App which itself sends out test emails OK. The ph version is "2.2 b3-5".
Dave... sorry to bother you again but I suspect your insights may be needed here.
Also it would be handy for all if the various email error returns (1-8?) could be documented here to help with debugging.
Edited by GadgetGuy - July 13 2022 at 09:11
__________________ Ken B - Live every day like it's your last. Eventually, you'll get it right!
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: July 16 2022 at 00:16 | IP Logged
|
|
|
Ken,
Google has been increasing their security and have made it increasingly harder to send email using their SMTP server. However, I did find a way to
do it.
The first thing you must do is create an "App Password" for your account. This is a special auto-generated password that PowerHome will use to
send email with the SMTP functions. I used the information on this site to do the setup: https://www.gmass.co/blog/gmail-smtp/
After you've got the 16 character app password, use the ph_sendsmtpemailfile1 function to send SMTP email. Below is an example:
ph_sendsmtpemailfile1("smtp.gmail.com",587,"powerhome","16ch aracterautopassword",1,"powerhome@gmail.com","dhoward@myx10. com","Test Message","This
is a test message","")
Even though the function implies sending a file, just set the filename parameter to empty string and then it will work just like the
ph_sendsmtpemail function. Also, note that port 465 (SSL) is essentially no longer supported so use port 587 for TLS. After creating the app
password, I was able to successfully send email using my Google account.
Dave.
|
Back to Top |
|
|
GadgetGuy Super User
Joined: June 01 2008 Location: United States
Online Status: Offline Posts: 942
|
Posted: July 16 2022 at 08:44 | IP Logged
|
|
|
Wow! Many thanks. I would never have figured that one
out without your assistance!!
Yahoo must have done similar things as I was aware of the
Google issues but could find no way to make Google work
so switched my FROM: email address from Google to Yahoo,
but I could not send that either.
Will try your method.
If I get it to work it means I will have a 100%
"Certified & Approved" ph installation for the 1st time
ever as I have been going over my several decades+ of
work and reviewing, correcting, and repairing it.
I have a new computer arriving next week that will fix my
bad memory drivers chip that fortunately supports a
largely unused memory area since my ph computer is so
static in its use. Ever since I have replaced my 25+year
old VB file trim code that was depreciated and is now
unsupported by Microsoft, ph has been rock stable.
__________________ Ken B - Live every day like it's your last. Eventually, you'll get it right!
|
Back to Top |
|
|
GadgetGuy Super User
Joined: June 01 2008 Location: United States
Online Status: Offline Posts: 942
|
Posted: July 16 2022 at 10:26 | IP Logged
|
|
|
Dave-
Can't get it to work. Got my Google Key and used it in sending the following....
ph_sendsmtpemailfile1("smtp.gmail.com",587,"ken burkhalter","
<mykeycode>",1,"kenburkhalter@gmail.com","kenburkhalte r@gmail.com","Battery Alert","A TempStick battery is low.","")
I also tried "kenburkhalter" and "kenburkhalter@gmail.com"for a login name with no success. I get a "Check Formula" Return of 1.
I also tried setting the default Windows mail App to Google as well as the Windows mail Default App (whatever they call it {old
Outlook?}.
Any suggestions?
PS-Can you fix the Title Text for this posting? Apparently an Apostrophe is not allowed in the title text and a HTML character
substitution was made. The word was intended to be "Doesn't"
Edited by GadgetGuy - July 16 2022 at 12:20
__________________ Ken B - Live every day like it's your last. Eventually, you'll get it right!
|
Back to Top |
|
|
dhoward Admin Group
Joined: June 29 2001 Location: United States
Online Status: Offline Posts: 4447
|
Posted: July 16 2022 at 22:30 | IP Logged
|
|
|
Ken,
Updated topic.
You'll definitely want to take the space out of your username. Everything else looks pretty good. The only thing I can think of is if
you typed the 16 character app password with spaces as I know it's shown as 4 blocks of 4. If so, there should be no spaces and the
password should be exactly 16 characters (case is probably important as well).
Let me know,
Dave.
|
Back to Top |
|
|
GadgetGuy Super User
Joined: June 01 2008 Location: United States
Online Status: Offline Posts: 942
|
Posted: July 17 2022 at 07:48 | IP Logged
|
|
|
Thanks for fixing the Title text. :-)
Re the email... my formula is (and has been) exactly as
you point out it should be. I also tested the 16 char
Google pw to make sure it works, and it does, so there
are no case issues.
I have sent you a private email to your "X10" account.
It contains all my login/pw info so you can try it.
NOTE: that email message I am about to send contains BOTH
gmail and yahoo efforts. If Yahoo is easier to send from
I would rather use that as the 2-stage gmail verification
complicates my multiple access device use. If it helps I
would even open a new email address somewhere that worked
with PH.
I look forward to your insights, and many thanks. I
always hate to bother you unless I am REALLY stumped, and
I am here as I have triied everything I can think of.
One more piece of info... when I try the gmail smtp send
I get an error return of 1. The Yahoo try yields an
error of 8.
__________________ Ken B - Live every day like it's your last. Eventually, you'll get it right!
|
Back to Top |
|
|
objector Newbie
Joined: August 20 2011 Location: United States
Online Status: Offline Posts: 31
|
Posted: January 13 2023 at 09:57 | IP Logged
|
|
|
Hi All,
Has anyone ever got this to work and if so please tell me
how you did it.
Thanks
|
Back to Top |
|
|
GadgetGuy Super User
Joined: June 01 2008 Location: United States
Online Status: Offline Posts: 942
|
Posted: January 13 2023 at 18:27 | IP Logged
|
|
|
Objector-
Good question. Dave helped me get it working but looking at it now I don't understand why it does work as the password that makes it work is the destination email server and NOT the one I'm sending from.
While the PH Help file for ph_sendsmtpemailfile1() makes sense it specifies that the 4th parameter () be the sending server password, but I can only get things to work when I use the destination server password !???
The issue apparently is a result of Google’s new 2-step authorization process.
After fighting for a month to make gmail work, I decided to switch over to my (virtually unused) Yahoo account, but I still could not get things to work following the Help instructions, but when I switched the ‘as_password’ with what I think is a Google Authorization key (a 16 character looking like “abcd efgh ijkl mnop”. But, it’s been a while so I am not sure where my 16-char password is from. It looks like a Google Authorization Key but checking now I can’t verify that.
Drop the inner grouping spaces when you use it in the sendmail, so you have a 16-character string with no spaces.
All this leads me to believe the ph_help file is incorrect.
Using the following ph formula construction I have been successful. My actual password not used.
ph_sendsmtpemailfile1("smtp.mail.yahoo.com",587,"kenburkhalt er@yahoo.com","abcdefghijklmnop",1,"kenburkhaltr@yahoo.com", "kenburkhalter@gmail.com","Battery Alert","Pantry Motion Sense battery low.","")
(Remove the spaces and return codes from the function. They are artifacts of the forum posting process.)
Perhaps Dave can jump in here and explain what belongs in the as_password field.
__________________ Ken B - Live every day like it's your last. Eventually, you'll get it right!
|
Back to Top |
|
|
objector Newbie
Joined: August 20 2011 Location: United States
Online Status: Offline Posts: 31
|
Posted: January 14 2023 at 03:29 | IP Logged
|
|
|
Hi GadgetGuy,
Thanks for the reply. I'll try it the way you have it later
today but I think you're right as I was having no luck the
way it looks like you're supposed to have things. Wasn't
sure if it was something I was screwing up or if Google had
changed something again.
Many thanks!!
|
Back to Top |
|
|