Take the 2-minute tour ×
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.

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:

127.0.0.1    localhost loghost
192.168.1.200   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 [127.0.0.1])
        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;
        boundary="r1F1K51c002398.1360891206/unknown"
Subject: Returned mail: see transcript for details
Auto-Submitted: auto-generated (failure)
Content-Length: 1287

This is a MIME-encapsulated message

--r1F1K51c002398.1360891206/unknown
share|improve this question
1  
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
1  
always check logs first; they'll tell you faster than stack exchange :) –  Stephan Feb 15 '13 at 0:17
1  
You need to properly configure Sendmail. Let me guess, you didn't configure it? –  bahamat Feb 15 '13 at 0:23
add comment

1 Answer 1

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
add comment

Your Answer

 
discard

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.