[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Sendmail or mailx sending to external SMTP server

Posted on 2013-06-07
5
Medium Priority
?
712 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 80

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

Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

Question has a verified solution.

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

How many times have you wanted to quickly do the same thing to a list but found yourself typing it again and again? I first figured out a small time saver with the up arrow to recall the last command but that can only get you so far if you have a bi…
Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Suggested Courses

656 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