LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 11-22-2014, 05:54 AM   #1
peng12
LQ Newbie
 
Registered: Sep 2012
Posts: 15

Rep: Reputation: Disabled
mailx doesn't read from /etc/mail.rc


Hello,

I'm trying to set up mailx (heirloom mailx) to be able to send mails from command line through gmail.

As of the manpage there are local configuration files (~/.mailrc) and a global configuration file (/etc/mail.rc)

Since I want the same settings for every user I thought it would be a good idea to put the Settings in /etc/mail.rc

the Content:

Code:
set ask askcc append dot save crt
ignore Received Message-Id Resent-Message-Id Status Mail-From Return-Path Via D$

account gmail {
        set smtp-use-starttls
        set ssl-verify=ignore
        set smtp-auth=login
        set smtp=smtp://smtp.gmail.com:587
        set from="Jon Doe"
        set smtp-auth-user=jon.doe@gmail.com
        set smtp-auth-password=somePasword
}
now to send an email I use
Code:
echo -e "Mail body text" | mailx -A gmail -s "Mail subject" some_recipient@email.com
Error message:
Code:
Account gmail does not exist.

When I put the configuration inside ~/.mailrc it works.
But why not with /etc/mail.rc?

Can someone help me out please?

Thanks in advance.
 
Old 11-23-2014, 07:00 AM   #2
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
You might try "/etc/nail.rc".

This depends on where the source for the mailx package came from AND whether it was updated/modified for the distribution.

I found that on the project source (I used mailx-12.4 - Linux From Scratch, sources) the source code uses "/usr/lib/Mail.rc", yet, searching the binary (on Slackware, using "strings /usr/bin/mailx | grep '\.rc'") I found it using /etc/nail.rc instead of /etc/mail.rc

As always, it is nice to be able to look at the source for hints.

Last edited by jpollard; 11-23-2014 at 07:03 AM.
 
1 members found this post helpful.
Old 11-23-2014, 08:23 AM   #3
peng12
LQ Newbie
 
Registered: Sep 2012
Posts: 15

Original Poster
Rep: Reputation: Disabled
That did the trick. Thank you very much!
 
  


Reply



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
Why mailx -e command doesn't work techie_san778 Linux - Software 8 02-04-2014 03:17 AM
How to forward mail in mailx ? techie_san778 Linux - Software 1 02-02-2014 06:39 AM
[SOLVED] How to send a mail in HTML format using mailx or mail or sendmail commands vishnu_knl Linux - Newbie 8 04-05-2012 10:00 AM
setup for mail/mailx smoooth103 Slackware 5 05-18-2010 09:25 PM
mail(mailx) to be nullclient? Chowroc Linux - Networking 0 12-18-2004 05:17 AM

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

All times are GMT -5. The time now is 06:59 AM.

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