-   Linux - Newbie (
-   -   mailx doesn't read from /etc/mail.rc (

peng12 11-22-2014 05:54 AM

mailx doesn't read from /etc/mail.rc

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:


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://
        set from="Jon Doe"
        set smtp-auth-password=somePasword

now to send an email I use

echo -e "Mail body text" | mailx -A gmail -s "Mail subject"
Error message:

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.

jpollard 11-23-2014 07:00 AM

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.

peng12 11-23-2014 08:23 AM

That did the trick. Thank you very much!

All times are GMT -5. The time now is 12:57 PM.