Sending EMAIL (simple)

8 replies [Last post]
brett
Offline
Providence, United States
Joined: 9 Jan 2010

A simple example to show how to send out an email on a state change.

Whenever relay 1 changes state an email is sent - very contrived to keep it simple.

Brett

AttachmentSize
simpleEmailApplet.lua797 bytes
magill
Offline
Joined: 27 Apr 2012
Email via Gmail

Hi

I've been trying to get this script to work using my Gmail credentials. Tried port 465 and 587. I've had no success. Anyone else?

thanks

John

magill
Offline
Joined: 27 Apr 2012
Gmail help

Anyone? I don't know whether to persevere or give up. Gmail seems to require "SSL"

thanks

John

brett
Offline
Providence, United States
Joined: 9 Jan 2010
I can take a look when I get

I can take a look when I get some time. I have a gmail account I can test with.

A quick google and I find this: http://stackoverflow.com/questions/11070623/lua-send-mail-with-gmail-acc... which requires lusec https://github.com/brunoos/luasec/wiki that is a wrapper around openssl.

openssl is not installed on the livebox but it is compiled and linked with when libcurl is setup, and its libcurl that we have, this is use for twitter and googlecal (albiet broken).
I've not looked into it but we could make libcurl dynamically link with openssl and then it include it, which would allow things like luasec to also use this openssl .so library file too which would provide SSL support to LUA enabling gmail...

OR

Given libcurl is already on the box just include a small xap-gmail program that does the handshaking for you and provides a nice xAP interface to chat with.  I'm thinking this route is simplier even if its very gmail specific.

http://talkbinary.com/programming/c/how-to-send-email-through-gmail-usin...
http://manojadinesh.blogspot.com.au/2012/11/smtp-libcurl.html

Brett

brett
Offline
Providence, United States
Joined: 9 Jan 2010
Sending gmail via xAP

John,

Update to 314.1 (beta) and check out http://www.dbzoo.com/livebox/gmail

Brett

magill
Offline
Joined: 27 Apr 2012
Fantastic

Brett

You're a superstar. I fiddle around a bit with VB net and some PHP and I'm in awe of how quickly you can provide a solution to our problems. When I suggested the sunrise/sunset scenario you had a solution in about an hour!! I hope others find this useful. One use I have for email is to send SMS via an email to sms service. Maybe Twitter provides a better solution, I have never used it.

All works well, but a couple of things

The GUI makes an entry in the ini file "passwd", should that be "password"

also

I get a response:-

Error Message: A xAP message received was malformed. Object reference not set to an instance of an object.
Received From: 10.0.0.40:59203

xap-header
{
target=dbzoo.livebox.Mail
class=email
}
message
{
to=*******@gmail.com
subject=How is your lamb?
text=I'll be around for dinner tonight at 6pm
}

Not sure what that means..

thanks again

John

brett
Offline
Providence, United States
Joined: 9 Jan 2010
John,I fixed the password

John,

I fixed the password problem, thanks for noticing that, I was in a hurry when I wrote this.  Try 314.2

I've also updated the wiki page xAP packet sample which wasn't suppose to be taken literally as a cut/paste. It would not have worked. As you found out.  It was missing several required fields which is why you got errors.   Anyway I updated the wiki page with a full payload sample.   I also noticed an error in the ok/error class it was class=mail and it should have been class=email for consistency but this was not a show stopper.

Brett

magill
Offline
Joined: 27 Apr 2012
Thanks BrettWorks perfectly

Thanks Brett

Works perfectly now

Lawrencezarb
Offline
Joined: 7 Mar 2012
SSL Authentication

Is it possible to adapt the script use an email account that requires SSL authentication?

Hardware Info