Guyver1
Posts: 18
Joined: Fri Aug 21, 2015 1:34 pm

Not sure how to or where to write the code. Hi

Sat Aug 10, 2019 7:58 pm

Hi guys.
I'm a complete new starter to raspberry pi and I'm stuck at the first hurdle.

I've bought a Spibox and got it setup with a RP2B+

It takes pics perfectly so that bit I did manage to figure out.
The bit where I'm stuck is getting my Gmail to work.

I've followed the instructions as best as I can understand them, but to be honest, they make no sense to me whatsoever.

Anyone out there able to help?

pcmanbob
Posts: 6618
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: Not sure how to or where to write the code. Hi

Sat Aug 10, 2019 8:07 pm

Well unless you tell us which Instructions you are following and what part you are having problems with there is not much we can do as we are have no idea what your problem is.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

User avatar
neilgl
Posts: 741
Joined: Sun Jan 26, 2014 8:36 pm
Location: Near Aston Martin factory

Re: Not sure how to or where to write the code. Hi

Sat Aug 10, 2019 8:34 pm

I thought it was on github with instructions how to set up email?
And it comes with a custom (old) version of raspbian?
https://github.com/sbcshop/Spi-Box

See also the other resurrected 2016 post on this
https://www.raspberrypi.org/forums/view ... 1&t=131077

Guyver1
Posts: 18
Joined: Fri Aug 21, 2015 1:34 pm

Re: Not sure how to or where to write the code. Hi

Sat Aug 10, 2019 8:59 pm

neilgl wrote:
Sat Aug 10, 2019 8:34 pm
I thought it was on github with instructions how to set up email?
And it comes with a custom (old) version of raspbian?
https://github.com/sbcshop/Spi-Box
Some of that is what I've used. Although some is completely different.

I'm not sure where a lot of that should be typed in relation on the screen to the original text.

pcmanbob
Posts: 6618
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: Not sure how to or where to write the code. Hi

Sat Aug 10, 2019 9:44 pm

If you are not following the instruction line for line then you need to explain in detail which instructions you are attempting to follow and what variations you are attempting ,

unless we know exactly what you are doing and how it's not working any attempt to help will be based on guess work.

A lot will also depend on exactly which version of raspbian you are using as ssmtp does not work on buster so you would need to use msmtp in its place.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

Guyver1
Posts: 18
Joined: Fri Aug 21, 2015 1:34 pm

Re: Not sure how to or where to write the code. Hi

Sat Aug 10, 2019 9:53 pm

pcmanbob wrote:
Sat Aug 10, 2019 9:44 pm
If you are not following the instruction line for pi e then you need to explain in detail which instructions you are attempting to follow and what variations you are attempting ,

unless we know exactly what you are doing and how it's not working any attempt to help will be based on guess work.
I can get into the screen where I have to type the commands.
The instructions say I should have root=postmaster
Mailhub=smtp.gmail.com:465
Fromlineoverride=YES

All those were easy to do.

But it also says I have to add

AuthUser=[email protected]
AuthPass=user_password
UseTLS=YES

Those are where I'm getting stuck.
Where do I type them firstly?
And do I type user_ and then my email address, or ignore the word and _?

pcmanbob
Posts: 6618
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: Not sure how to or where to write the code. Hi

Sat Aug 10, 2019 10:21 pm

So you are attempting to set up ssmtp and you are at the point of editing ssmtp.conf,

Code: Select all

sudo nano /etc/ssmtp/ssmtp.conf

so all those lines need to be in the file along with some others,

so were it says type " AuthUser=[email protected] " you need to replace the " [email protected] " with the actual account you want to use ,
were it says " AuthPass=user_password " you need to replace " user_password " with the actual password.

when you are done your ssmtp.cof file should look like this

Code: Select all

#
# Config file for sSMTP sendmail
#
# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.
root=PUT EMAIL ADDRESS HERE THAT YOU WANT ERRORS SENDING TO

# The place where the mail goes. The actual machine name is required no 
# MX records are consulted. Commonly mailhosts are named mail.domain.com
#mailhub=mail
mailhub=smtp.gmail.com:587

AuthUser=PUT ACCOUNT ADDRESS HERE
AuthPass=PUT ACCOUNT PASSWORD HERE
UseTLS=YES
UseSTARTTLS=YES

# Where will the mail seem to come from?
rewriteDomain=gmail.com

# The full hostname
hostname=testpi2

# Are users allowed to set their own From: address?
# YES - Allow the user to specify their own From: address
# NO - Use the system generated From: address
FromLineOverride=yes
All this is of course point less if you are using raspbian buster because as I said above ssmtp does not work on buster.
Last edited by pcmanbob on Sat Aug 10, 2019 10:29 pm, edited 1 time in total.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

pcmanbob
Posts: 6618
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: Not sure how to or where to write the code. Hi

Sat Aug 10, 2019 10:27 pm

Before you go any further I suggest you run the following command

Code: Select all

cat /etc/os-release
you need to run this in a terminal window or at the command line if you are using a command line only version of raspbian.

then post the output here so we can see which version of raspbian you are using.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

Guyver1
Posts: 18
Joined: Fri Aug 21, 2015 1:34 pm

Re: Not sure how to or where to write the code. Hi

Sat Aug 10, 2019 11:48 pm

pcmanbob wrote:
Sat Aug 10, 2019 10:27 pm
Before you go any further I suggest you run the following command

Code: Select all

cat /etc/os-release
you need to run this in a terminal window or at the command line if you are using a command line only version of raspbian.

then post the output here so we can see which version of raspbian you are using.
PRETTY_NAME "Raspbian GNU/Linux 9 (stretch)"
VERSION_ ID="9"
VERSION="9 (stretch)"
ID=Raspbian
ID_LIKE=debian

pcmanbob
Posts: 6618
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: Not sure how to or where to write the code. Hi

Sun Aug 11, 2019 9:38 am

Guyver1 wrote:
Sat Aug 10, 2019 11:48 pm
PRETTY_NAME "Raspbian GNU/Linux 9 (stretch)"
VERSION_ ID="9"
VERSION="9 (stretch)"
ID=Raspbian
ID_LIKE=debian
So you are running raspbian stretch so ssmtp will work just fine, so you can continue to follow the tutorial and it should be able to send emails.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

Guyver1
Posts: 18
Joined: Fri Aug 21, 2015 1:34 pm

Re: Not sure how to or where to write the code. Hi

Sun Aug 11, 2019 12:12 pm

pcmanbob wrote:
Sun Aug 11, 2019 9:38 am
Guyver1 wrote:
Sat Aug 10, 2019 11:48 pm
PRETTY_NAME "Raspbian GNU/Linux 9 (stretch)"
VERSION_ ID="9"
VERSION="9 (stretch)"
ID=Raspbian
ID_LIKE=debian
So you are running raspbian stretch so ssmtp will work just fine, so you can continue to follow the tutorial and it should be able to send emails.
Brilliant 👍
I've typed it in like you've shown me.
I'm going to try to figure out how to save it and see if it makes any difference.

Guyver1
Posts: 18
Joined: Fri Aug 21, 2015 1:34 pm

Re: Not sure how to or where to write the code. Hi

Sun Aug 11, 2019 12:25 pm

I've opened the SPi-Box Setup window and email address is added. I've clicked on test email but getting nothing.
The sudo window is saying
Motion detected! Taking snapshot
1
emailing2019-08-13.19.20_1.jpg
send mail: Authorization failed (535 5.7.8 https://support.google.com/mail/?p=BadCredentials b186sm14694835wmb.3 - gsmtp)
moving2019-08-11_13.19.20_1.jpg

Not a clue what that means

pcmanbob
Posts: 6618
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: Not sure how to or where to write the code. Hi

Sun Aug 11, 2019 12:34 pm

It means either the user name ( ie email address ) or the password are wrong.

I set up a separate gmail account for use with my pi's and I found that if you use only the A-Z,a-z, 0-9 - . characters and no other special characters you will have a lot less problems with ssmtp as it does not handle special character in the user name or password very well.

you will also need to enable less secure apps on the gmail account, another reason to use a separate account.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

Guyver1
Posts: 18
Joined: Fri Aug 21, 2015 1:34 pm

Re: Not sure how to or where to write the code. Hi

Sun Aug 11, 2019 12:43 pm

I've changed the 587 to 465 as that's what listed in the instructions.

Still doesn't work, bit I get a different error

emailing2019-08-11_13.39.32_1.jpg
send mail: Cannot open smtp.gmail.com:465

So it looks like it's Gmail that's the issue

Guyver1
Posts: 18
Joined: Fri Aug 21, 2015 1:34 pm

Re: Not sure how to or where to write the code. Hi

Sun Aug 11, 2019 12:45 pm

Just double checked email and password. Both are as should be.

Just using letters and . to separate my first and last name.

pcmanbob
Posts: 6618
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: Not sure how to or where to write the code. Hi

Sun Aug 11, 2019 1:03 pm

It needs to be port 587 that's what gmail uses and has done for as long as I have been sending emails from my pi's ,

did you enable less secure apps on the gmail account ?

have you tried logging in to the account from a pc via the browser to see if there are any security messages from google and to check the account log in credentials.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

Guyver1
Posts: 18
Joined: Fri Aug 21, 2015 1:34 pm

Re: Not sure how to or where to write the code. Hi

Sun Aug 11, 2019 3:30 pm

pcmanbob wrote:
Sun Aug 11, 2019 1:03 pm
It needs to be port 587 that's what gmail uses and has done for as long as I have been sending emails from my pi's ,

did you enable less secure apps on the gmail account ?

have you tried logging in to the account from a pc via the browser to see if there are any security messages from google and to check the account log in credentials.
Changed back to 587
How do I enable less secure apps. Can't see anything listed on Google.
Is it just my Gmail account I need to log into to check for messages?

pcmanbob
Posts: 6618
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: Not sure how to or where to write the code. Hi

Sun Aug 11, 2019 3:32 pm

Just Google enable less secure apps.

You need to log in to the account you are trying to use on the pi.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

Guyver1
Posts: 18
Joined: Fri Aug 21, 2015 1:34 pm

Re: Not sure how to or where to write the code. Hi

Sun Aug 11, 2019 3:56 pm

pcmanbob wrote:
Sun Aug 11, 2019 3:32 pm
Just Google enable less secure apps.

You need to log in to the account you are trying to use on the pi.
Google says i need to be a G suite user to allow me to change less secure apps
I've just got a normal gmail account

Guyver1
Posts: 18
Joined: Fri Aug 21, 2015 1:34 pm

Re: Not sure how to or where to write the code. Hi

Sun Aug 11, 2019 4:37 pm

YESSSSSSSSSSS !!!!!!!!!!!!!!!!

It's worked.

pcmanbob you are a GOD!!!
If you're ever in the Black Country, I'll buy you a pint

Thankyou so much for helping me with this.

Now all I need to do is figure out how to get the Spibox to sit where I want it.
We have 5 cats and 1 decided that behind the TV is ideal to empty their backside, we haven't caught the culprit yet but now we can find out who it is, hopefully!

pcmanbob
Posts: 6618
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: Not sure how to or where to write the code. Hi

Mon Aug 12, 2019 12:06 am

I guess you found the correct place to enable less secure apps on your account then.

glad its working ok for you now.
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

Guyver1
Posts: 18
Joined: Fri Aug 21, 2015 1:34 pm

Re: Not sure how to or where to write the code. Hi

Mon Aug 12, 2019 12:40 am

pcmanbob wrote:
Mon Aug 12, 2019 12:06 am
I guess you found the correct place to enable less secure apps on your account then.

glad its working ok for you now.
Yes, it took ages to find it. I'm not use to using Gmail as I've always had Hotmail accounts before.

Once found and switched over my camera went into overdrive. Doesn't work as great as I would like as it needs decent light. But I've got a few ideas of where else I can install the camera where it will get the required light.
Once again, thank you for your help. 👍

Return to “Beginners”