I'm 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-from-the-raspberry-pi/
I did steps 1,2,3,4 from the link.
When I send an email using the code below using
echo "Test text" | mail -s "Test Mail" email@example.com
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
send-mail: Cannot open mail.google.com:587
send-mail: Server didn't like our AUTH LOGIN (530 5.7.0 Must issue a STARTTLS command first. ml2sm3592928igb.10 - gsmtp)
How can I fix this?
Here are the two files below:
# # 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 firstname.lastname@example.org mailhub=smtp.gmail.com:587 AuthUseremail@example.com AuthPass=mypass UseSTARTTLS=YES
# sSMTP aliases # # Format: local_account:outgoing_address:mailhub # # Example: root:firstname.lastname@example.org:mailhub.your.domain[:port] # where [:port] is an optional port number that defaults to 25. root:email@example.com:mail.google.com:587