Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to send emails using the following bash script:

/bin/mail -s "#subject" "$emailto" < "$message" 

It works fine on my local machine but does not work on my VM. I looked it up and read that the issue might be related to the /etc/hosts file, so here is the contents of that file:    localhost loghost   root loghost

I am root user on this solaris VM. What do I need to do change get this working?

I am getting this msg in log file

From MAILER-DAEMON Thu Feb 14 20:20:06 2013
Return-Path: <>
Received: from unknown (localhost [])
        by unknown (8.14.4+Sun/8.14.4) with ESMTP id r1F1K57F002411
        for <root@unknown>; Thu, 14 Feb 2013 20:20:06 -0500 (EST)
Received: from localhost (localhost)
        by unknown (8.14.4+Sun/8.14.4/Submit) id r1F1K51c002398;
        Thu, 14 Feb 2013 20:20:06 -0500 (EST)
Date: Thu, 14 Feb 2013 20:20:06 -0500 (EST)
From: Mail Delivery Subsystem <MAILER-DAEMON@unknown>
Message-Id: <201302150120.r1F1K51c002398@unknown>
To: root@unknown
MIME-Version: 1.0
Content-Type: multipart/report; report-type=delivery-status;
Subject: Returned mail: see transcript for details
Auto-Submitted: auto-generated (failure)
Content-Length: 1287

This is a MIME-encapsulated message

share|improve this question
Could you expand on 'not working?' What isn't working? Is there anything in your mail logs? – Stephan Feb 15 '13 at 0:13
I am not getting email to.did not check the error logs – user1212207 Feb 15 '13 at 0:16
always check logs first; they'll tell you faster than stack exchange :) – Stephan Feb 15 '13 at 0:17
You need to properly configure Sendmail. Let me guess, you didn't configure it? – bahamat Feb 15 '13 at 0:23

As indicated in the comments, you should configure sendmail. Most likely the only thing you need will be editing the sendmail.conf and setting the DS"IP" for the relay host.

Also make sure that your main mail server accepts mail from your VM.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.