The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers > Answers to Frequently Asked Questions > How do I send email?
Google UNIX.COM


How do I send email? How do I send an mail attachment from the command line?

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Send mail attachments and have a mail body shibajighosh AIX 1 04-18-2008 10:54 AM
Pull E-mail address from file, send e-mail DC Heard Shell Programming and Scripting 1 01-28-2008 10:23 PM
mail problems - how to send mail on solaris amon SUN Solaris 10 04-06-2006 06:31 AM
I am not able to send mail form unix to other mail accounts. chinnigd UNIX for Dummies Questions & Answers 1 04-06-2006 05:31 AM
can not send mail from unix server to company/yahoo mail b5fnpct UNIX for Dummies Questions & Answers 5 11-22-2002 05:24 PM

 
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-19-2004
piltrafa's Avatar
Registered User
 

Join Date: Oct 2001
Location: Buenos Aires, Argentina
Posts: 76
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
events send mail to admin -

Hi everybody !!

I want to do something and I can't figure out. The idea is that a script should send an email when a backup is done.
It works with a unix account (like root) but what I really want is to send that email to other account like fede@somethig.com.

I have a mail server installed in other computer, all these boxes are running solaris 9.

I believe that I should tell the box that is running the backup script to send the email using other mail server, but I don't know how to do it.

Also, as a test, I tried: mail -t myaccount@stuff.com, and it doesn´t work. (of course the email acount exist...)

So if someone can help me, I'll send a pack of six beers...

Thanx a lot.
Forum Sponsor
  #2 (permalink)  
Old 04-19-2004
flim flam flamma jamma
 

Join Date: May 2001
Location: Chicago IL, USA
Posts: 1,006
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
it really depends on how your doing the backup in the first place.

for me. i run my backups via cron and i have the output goto the cronusers email. you can always pipe the output to the mail command and then you can specify which user.

some backup software allows you to configure users to be notified when an event happens. so i would check your software docs and see what you can come up with, or talk with the people that manage the backups and set it up in the first place they would prolly have the most valuable information for you.
  #3 (permalink)  
Old 04-19-2004
piltrafa's Avatar
Registered User
 

Join Date: Oct 2001
Location: Buenos Aires, Argentina
Posts: 76
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
No, it is just a normal script like:

----------------------------------------
# !/bin/bash

cd /tmp
cp /tmp /home/mystuff

# and when the copy is done I want to be informed by mail
# but not to my unix account like root, I want the mail to, for # example, myaccount@hotmail.com.

????

------------------------------------------

Thanks for your help
  #4 (permalink)  
Old 04-19-2004
Neo's Avatar
Neo Neo is offline
Administrator
 

Join Date: Sep 2000
Location: Asia Pacific
Posts: 4,061
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
You can create a shell script and test to see if it executes without error. If it executes without error, then you can email a success message; if with error, you can email an error message.

Take a look at error codes, for example:

ps aux | grep grep | grep -v grep ; echo $?

Then try:

ps aux | grep grep; echo $?

Are the results the same? Why not?
  #5 (permalink)  
Old 04-20-2004
piltrafa's Avatar
Registered User
 

Join Date: Oct 2001
Location: Buenos Aires, Argentina
Posts: 76
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
Thanks, but my problems is not with the script, what I really don't know how to do is sending the mail from a command.

mail -t sends a mail only to unix account and I want to send the mail to an "outside" mail account like something@hotmail.com

Thanks again.
  #6 (permalink)  
Old 04-20-2004
Neo's Avatar
Neo Neo is offline
Administrator
 

Join Date: Sep 2000
Location: Asia Pacific
Posts: 4,061
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
Try this:

echo "Hello World!" | elm -s "Hello World Message" your_name@your.domain.com
  #7 (permalink)  
Old 04-20-2004
Ygor's Avatar
Moderator
 

Join Date: Oct 2003
Location: -31.96,115.84
Posts: 1,208
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
I think mailx is the standard front-end for sendmail and elm is HP-UX only(?)

echo "Hello World!" | mailx -s "Hello World Message" your_name@your.domain.com
  #8 (permalink)  
Old 04-20-2004
Neo's Avatar
Neo Neo is offline
Administrator
 

Join Date: Sep 2000
Location: Asia Pacific
Posts: 4,061
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
Elm works on most systems. It comes standard with Linux and myriad other systems (not related to HP-UX).

Visit:

http://www.instinct.org/elm/
  #9 (permalink)  
Old 04-20-2004
piltrafa's Avatar
Registered User
 

Join Date: Oct 2001
Location: Buenos Aires, Argentina
Posts: 76
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
Ok, now it works. Because the os is Solaris I use the mailx, as you mention. At first it doesn´t work, the I wento to my /etc/mail/sendmail.cf and I added "DSmymailserver."

With this line worked, the mail is forwarder to my mail server.
Fine.

Thanks for your help, it was great.

See ya.
  #10 (permalink)  
Old 04-20-2004
Ygor's Avatar
Moderator
 

Join Date: Oct 2003
Location: -31.96,115.84
Posts: 1,208
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
I guess Solaris is not one of those "myriad" systems.
  #11 (permalink)  
Old 04-20-2004
Neo's Avatar
Neo Neo is offline
Administrator
 

Join Date: Sep 2000
Location: Asia Pacific
Posts: 4,061
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
I think you can compile elm with GCC and GCC can be built on Solaris.

My thoughts are that everyone would install GCC on Solaris, HP-UX or any more commercial system as one of their first admin tasks

Here is a link where someone was using GCC to build elm on a Sun in 1994

http://www.geocrawler.com/archives/3...4/9/0/1962250/

Time flies......

Here is a 1998 link that shows elm as freeware for Solaris 2.5:

http://smc.vnet.net/solaris_2.5_nof.html

And Solaris 7:

http://sunfreeware.com/programlistsparc7.html

Including this critical link:

http://sunfreeware.com/gcc.html
  #12 (permalink)  
Old 04-20-2004
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,252
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit! Stumble this Post!Spurl this Post!
Rightly or wrongly, a lot of people are intimidated by the effort of downloading source code and building a package. That's why precompiled freeware is important. Sun distributes elm... see this link.

A HP engineer wrote elm for fun and HP accepted it as part of HP-UX. But elm was released as freeware and has been enhanced. So even though elm comes standard with HP-UX, it is an older version. The standard HP-UX elm is a nice program, but you might want to consider a newer version. One newer elm precomplied for HP-UX is available here.
Google UNIX.COM
 

Tags
linux, sendmail, solaris

Thread Tools
Display Modes


The 50 most popular UNIX and Linux searches.
Google Search Cloud for The UNIX and Linux Forums
421 service not available, remote server has closed connection ^m automate ftp autosys awk trim bash eval bash for loop boot: cannot open kernel/sparcv9/unix command copy/move folder in unix curses.h cut command in unix daemon process export command in unix find grep find mtime find null character in a unix file glance unix grep multiple lines grep or grep recursive inaddr_any inappropriate ioctl for device lynx javascript mailx attachment mget mtime perl array length ping port remove first character from string in k shell replace space by comma , perl script scp recursive segmentation fault(coredump) sftp script snoop unix stale nfs file handle syn_sent tar exclude tar extract to folder test: argument expected unix unix .profile unix forum unix forums unix internals unix interview questions unix mtime unix simulator unix.com vi substitute while loop within while loop shell script


All times are GMT -7. The time now is 12:50 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101