LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-03-2016, 09:53 AM   #1
Entropy1024
Member
 
Registered: Dec 2012
Location: UK
Distribution: Ubuntu 16 & 17
Posts: 131

Rep: Reputation: Disabled
sending mail with mailutils


I have installed mailutils to enable me to send emails via the terminal. After install I tried the following:

Code:
mail -s "Hello Friend" myelail@gmail.com
I returned on the Cc and then added some text for the body then pressed CTRL+D to send. I was then at the prompt again with no success or failure message, however no email either. I was a bit suspicious of it just working without any SMTP setting etc being configured. So then I tried the following:

Code:
~ sudo apt-get install ssmtp
~ sudo vim /etc/ssmtp/ssmtp.conf
Uncomment FromLineOverride=YES by deleting the #
Added the following to the file:
AuthUser=<user>@gmail.com
AuthPass=Your-Gmail-Password
mailhub=smtp.gmail.com:587
UseSTARTTLS=YES
Tried sending again and still no email sent.
Do you know why the mail command is failing and how I correct it?
Many thanks
Tim
 
Old 09-03-2016, 12:31 PM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
Tried sending again and still no email sent.
Do you know why the mail command is failing and how I correct it?
You should take a look at the mail logs (usually located at /var/log/maillog, or /var/log/mail) to see what happens.

Regards
 
Old 09-03-2016, 12:36 PM   #3
Emerson
LQ Sage
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~amd64
Posts: 7,661

Rep: Reputation: Disabled
Your mail can be rejected if you do not have PTR record.
 
Old 09-04-2016, 03:11 AM   #4
Entropy1024
Member
 
Registered: Dec 2012
Location: UK
Distribution: Ubuntu 16 & 17
Posts: 131

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by Emerson View Post
Your mail can be rejected if you do not have PTR record.
Whats PTR record?
 
Old 09-04-2016, 03:50 AM   #5
Entropy1024
Member
 
Registered: Dec 2012
Location: UK
Distribution: Ubuntu 16 & 17
Posts: 131

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by bathory View Post
You should take a look at the mail logs (usually located at /var/log/maillog, or /var/log/mail) to see what happens.

Regards
Unfortunately there are no mail related logs under /var/log/ would they be anywhere else?
 
Old 09-04-2016, 10:10 AM   #6
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
Quote:
Originally Posted by Entropy1024 View Post
Unfortunately there are no mail related logs under /var/log/ would they be anywhere else?
I don't think so, but you should read you distro's documentation.
Anyways, since you've installed ssmtp, try the following:
Code:
ssmtp myelail@gmail.com < /path/to/somefile.txt
 
1 members found this post helpful.
  


Reply

Tags
mail



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ssmtp and mailutils, can not send mail... willc86 Linux - Software 0 06-13-2015 06:46 AM
GNU Mailutils 2.99.98 is not saving mail in the correct directory Alpha90 Linux - Software 0 01-07-2015 09:44 AM
Mailutils (mail command) seprob Linux - Server 9 10-31-2008 03:16 AM
troubles of mailutils & mail command tatsuya Linux - Newbie 2 06-15-2008 08:52 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:41 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration