Find the answer to your Linux question:
Results 1 to 3 of 3
I have a bash script on my linux server which does everything it's supposed to do except emailing me the output. I need to get it to relay the mail ...
  1. #1
    Just Joined!
    Join Date
    Mar 2008
    Posts
    2

    Problem sending email from bash script

    I have a bash script on my linux server which does everything it's supposed to do except emailing me the output. I need to get it to relay the mail through our exchange server. To enable this I added the name of our exchange server to the sendmail.cf file under 'Smart Relay' and restarted the sendmail service. However, sendmail seems to be doing a DNS lookup instead and ignoring the exchange server. Can anyone advise me on how I can get around this? I'm the first to admit that I have only a very loose grasp on what I'm doing....

  2. #2
    Linux Engineer
    Join Date
    Oct 2004
    Location
    Vancouver
    Posts
    1,366
    can you send mail from sendmail or mail or emacs/rmail or mutt from your computer? The problem may be in one of the sendmail config files, there are two, rather than a problem with your bash script.

    Sendmail is really hard to configure, and once configured it is hard to reconfigure. I recommend trying exim4, it is incredibly self intuitive, tests itself out easily, and if you are on a debian system, dpkg-reconfigure seems to work flawlessly.

    Here is a link that you may want to follow to make sure all of your options are set up correctly.

    email perfect setup

    Once you are sure that you can send mail from your terminal, then getting the bash script right will be the easy part.
    Operating System: GNU Emacs

  3. #3
    Just Joined!
    Join Date
    Mar 2008
    Posts
    2
    The problem is definitely is my sendmail config. I have tried piping the echo command into mail as a test ('echo "testing email" | mail me@mydomain.com). When we checked the mail logs we were able to see that the message was not routing through our exchange server but instead was taking the first server from the list after doing a DNS lookup. I'm on redhat. Can you give me any advice on configuring sendmail to use a relay server? Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...