sneaky
Posts: 1
Joined: Thu Dec 19, 2013 9:47 pm

Mail function is not working

Thu Dec 19, 2013 9:57 pm

Hi,

Im new to raspberry pi.

I installed the raspian OS on it. I want to send emails from it using my gmail account. I want to send from the command line interface and from php scripts.

I followed this guide.
http://iqjar.com/jar/sending-emails-fro ... pberry-pi/

I did steps 1,2,3,4 from the link.


When I send an email using the code below using

Code: Select all

echo "Test text" | mail -s "Test Mail" [email protected]
nothing happens, there is nothing printed on the screen, and I don't get the email.

On "revaliases", if I replace "mail.google" with "smtp.gmail", then I get back a message saying

Code: Select all

send-mail: Cannot open mail.google.com:587
or

Code: Select all

send-mail: Server didn't like our AUTH LOGIN (530 5.7.0 Must issue a STARTTLS command first. ml2sm3592928igb.10 - gsmtp)

Does anyone know how to fix this?
Thanks

Here are the two files below:

ssmtp.conf

Code: Select all

#
# Config file for sSMTP sendmail
#
# The person who gets all mail for userids < 1000
# Make this empty to disable rewriting.
# root=postmaster

# 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

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

# The full hostname
hostname=raspberrypi

# 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


[email protected]
mailhub=smtp.gmail.com:587
[email protected]
AuthPass=mypass
UseSTARTTLS=YES
revaliases

Code: Select all

# sSMTP aliases
# 
# Format:	local_account:outgoing_address:mailhub
#
# Example: root:[email protected]:mailhub.your.domain[:port]
# where [:port] is an optional port number that defaults to 25.

root:[email protected]:mail.google.com:587

fr0zen
Posts: 6
Joined: Sat Dec 21, 2013 9:19 pm

Re: Mail function is not working

Sat Dec 21, 2013 9:56 pm

The email on my Pi works using the same command line code you pasted, so something must be up.

This is the only line I use in my revaliases file:

Code: Select all

pi:[email protected]:smtp.gmail.com:587
Also did you chmod it like the article suggests:

Code: Select all

chmod 774 /etc/ssmtp/ssmtp.conf
If this doesn't work it might be your ssmtp.conf file.

User avatar
DougieLawson
Posts: 36130
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Mail function is not working

Sun Dec 22, 2013 8:53 pm

You need a MTA running.

sudo apt-get install postfix
that one is sane and easy to configure.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

crystalblade
Posts: 7
Joined: Wed Dec 27, 2017 7:39 am

Re: Mail function is not working

Thu Dec 28, 2017 1:16 pm

Hi
Did you solve your problem?
Because i am following the same article and have the same problem as you did.
Let me know if you got it working and how you did it.
Thx

tpylkko
Posts: 382
Joined: Tue Oct 14, 2014 5:21 pm

Re: Mail function is not working

Thu Dec 28, 2017 1:55 pm

I believe gmail wont allow you to send mail unless you either 1) use one of Google's own mail clients (or other popular ones that are whitelisted) or 2) change the account settings so that you "allow unsafe programs" (or something to that end) from the options.

User avatar
rpdom
Posts: 15200
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: Mail function is not working

Thu Dec 28, 2017 2:16 pm

Following four year old instructions is not a good idea. Much has changed since then.

fruitoftheloom
Posts: 20725
Joined: Tue Mar 25, 2014 12:40 pm
Location: Delightful Dorset

Re: Mail function is not working

Thu Dec 28, 2017 2:48 pm

crystalblade wrote:
Thu Dec 28, 2017 1:16 pm
Hi
Did you solve your problem?
Because i am following the same article and have the same problem as you did.
Let me know if you got it working and how you did it.
Thx
Necromancing an ancient thread.

Try this from 2017:

http://hacking.elboulangero.com/2017/07 ... gmail.html
Retired disgracefully.....

Return to “General discussion”