6

I am using mailx command to send mail, I tried it by two ways..

mailx -s "This is Subject" toAddr < bodyFile.txt
mailx -r "fromAddr" -s "This is Subject" toAddr < bodyFile.txt

I am getting same error:

send-mail: fatal: parameter inet_interfaces: no local interface found for ::1

I want to know how to resolve that error as well as following things:

  • What does mailx takes fromAddress by default?
  • What does mailx takes Mail Transfer Agent address by default?
  • From where to change these values?
Rui F Ribeiro
  • 56,709
  • 26
  • 150
  • 232

3 Answers3

8
# cat /etc/redhat-release
CentOS Linux release 7.3.1611 (Core)

# more  /var/log/maillog
Sep  1 17:07:50 izuf6cj2o216xp postfix/sendmail[25307]: fatal: parameter inet_interfaces: no local interface found for ::1

Solved it:

vim /etc/postfix/main.cf
#inet_interfaces = localhost
inet_interfaces = all

then

service postfix start
zhuguowei
  • 191
3

Mailx is just a command-line tool to pass mail to your Mail Transfer Agent (MTA; whatever it is you have installed: sendmail, exim, ...). It does this by invoking the command sendmail (usually /usr/sbin/sendmail). Your MTA provides this command to, well, send mail.

In your case, it tries to contact a server on the IPv6 address of the loopback device on localhost (::1), and can't find anything. So either your MTA is not configured correctly (uses IPv6 instead of IPv4), or your IPv6 networking setup is not correct (no ::1 address on loopback interface).

The default from-address is your username, and the MTA adds whatever domain name you have configured in your MTA (and may further rewrite this according to various criteria like which mail server it contacts to deliver the mail, if you've set up rules for it).

You change these values by configuring your MTA.

I don't understand the question "what does mailx takes MTA address by default". If you mean "which MTA does it use", as I said, it just invokes the sendmail command, so it uses whatever MTA package you have installed that provides this command.

dirkt
  • 32,309
  • Can I consider there is a MTA installed for sure if I have sendmail command?? – firoj_mujawar Nov 17 '16 at 06:52
  • @firoj_mujawar: It's often a symbolic link, so I'd do an ls -l /usr/bin/sendmail and look closely at where it links to ... You still may have some package installed that simulates some part of sendmail (like "local delivery only"), but isn't a full MTA. – dirkt Nov 17 '16 at 06:58
  • atfer doing ls -l /usr/sbin/sendmail it shows "lrwxrwxrwx. 1 root root 21 Nov 18 2015 /usr/sbin/sendmail -> /etc/alternatives/mta" Is this the full MTA or something else as it lies in etc/alternatives – firoj_mujawar Nov 17 '16 at 07:21
  • @firoj_mujawar: That means you use Debian or a Debian based system like Ubuntu, you have several MTA-like packages installed, and now you have to do a ls -l /etc/alternatives/mta to find out where it really points to. See e.g. Debian Alternatives System. – dirkt Nov 17 '16 at 07:30
  • I done that and found it points to "/usr/sbin/sendmail.sendmail" and i also done ls -l /usr/sbin/sendmail.sendmail then it shows the info about that, it points to itself i guess. I searched for my system distributor details, I got it as RedHatEnterpriseServer(i am working on putty terminal) – firoj_mujawar Nov 17 '16 at 07:52
  • @firoj_mujawar: This looks like the original sendmail, and I hope it's configured correctly, because configuring it is a real PITA. So you have an MTA. – dirkt Nov 17 '16 at 08:01
1

Probably you don't have a properly configured local MTA running which mailx wants to use by default.

You can use mailx to directly send email via your public smtp account.

echo "This is the text." | \
  env MAILRC=/dev/null  \
  from=from@your_domain  \
  smtp=your_smtp_server:port  \
  smtp-auth-user=your_login  \
  smtp-auth-password=your_pwd  \
  smtp-auth=login \
  smtp-use-starttls=yes  \
  mailx -n -s "test 1" to@domain

Or install and setup a local MTA like postfix or exim. Nowadays some distros don't install MTAs by default anymore.

rudimeier
  • 10,315