Solved

Sendmail or mailx sending to external SMTP server

Posted on 2013-06-07
5
662 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 78

Accepted Solution

by:
arnold earned 500 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

Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
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.:
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

730 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