?
Solved

Sendmail or mailx sending to external SMTP server

Posted on 2013-06-07
5
Medium Priority
?
695 Views
Last Modified: 2013-06-14
I just realized in my wealth (LOL) of linux knowledge, I have never set up an email client.  I have a script that needs to send a log file.  I use a program on windows called blat, which is simple and light.  When you install blat, you point to an SMTP server (open relay) and assign an email address....  Easy as pie.  

Without linking (I've read about 300 pages of trash), can anyone please provide a simple step by step to send email from the command line/shell without blowing my mind setting up MTA's and postfix....  I literally just need to send a log file to my email account from the linux machine on the same physical network and my patience are wearing thin...
0
Comment
Question by:choward16980
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 16

Author Comment

by:choward16980
ID: 39229768
PS, this is rPath.  mail, mailx and sendmail are on the box.  I also installed mutt to no avail
0
 
LVL 79

Accepted Solution

by:
arnold earned 2000 total points
ID: 39229844
Sendmail is the component that delivers emails.
You do not need a mail client for script

(echo "To: emailaddress
From: sender address
Subject: test

This is a test";
cat logfile;

) | /usr/lib/sendmail -oi -t

Look at /var/log/maillog for information on what happened to the email.
0
 
LVL 27

Expert Comment

by:skullnobrains
ID: 39231150
using default settings, the MTA should already be setup for sending email in any linux distribution so you sould be able to simply use the "mail" command in order to drop your mail in maildrop and let the MTA pick it.

if your mta is a no-go, you can find plenty of equivalents to blat. smtpclient is one i remember using successfully, but there are others

it is not too complicated either to code a simple shell script using netcat

both the latter are a less good solution than using the MTA because if the remote server is down at the time your report is supposed to be sent, it will be lost. same with blat.
0
 
LVL 13

Expert Comment

by:Sandy
ID: 39234708
on windows you can even use sendmail client. please find below link


http://www.indigostar.com/smuman.html

Cheers,
sA
0
 
LVL 16

Author Closing Comment

by:choward16980
ID: 39236192
The issue was there was no host record for the smtp server.  I set up the domain I was trying to send to and pointed it toward the SMTP relay and everything came through as expected.  Thanks!

PS. the host record is /etc/hosts

hosts is the file
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Suggested Courses
Course of the Month11 days, 1 hour left to enroll

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question