LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 03-17-2005, 06:12 PM   #1
rjcrews
Member
 
Registered: Apr 2004
Distribution: Debian
Posts: 193

Rep: Reputation: 30
Postfix-how to mail from bash


hi

i can send mail using mail() in a php file. I believe I have Postfix installed correctly or this would not work.

Is there anyway to send mail in a bash script?

having read man of sendmail and postfix i am completely lost. with php its pretty easy, does anyone know a of a simple walkthrough or have a simple code snipet that would help?


thx in advance
 
Old 03-17-2005, 06:56 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Most distroswill have "mail" installed by default ...

The quick answer is:
Code:
cat <message-file> | mail -s Subject recipient@target.domain

Cheers,
Tink
 
Old 03-17-2005, 08:38 PM   #3
rjcrews
Member
 
Registered: Apr 2004
Distribution: Debian
Posts: 193

Original Poster
Rep: Reputation: 30
thanks, i tried that and got

line 4: mail: command not found

basically all i have for code is

#!/bin/bash

FILE="test"
cat $file | mail -s testmsg myadress@domain

do i need to include something else?
 
Old 03-17-2005, 08:58 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
Maybe your fc3 install doesn't have mail
installed ... check whether you can get it
(of CD or from rpmfind.net).


Cheers,
Tink
 
Old 03-17-2005, 09:04 PM   #5
rjcrews
Member
 
Registered: Apr 2004
Distribution: Debian
Posts: 193

Original Poster
Rep: Reputation: 30
ah sorry its gentoo. guess i need to change that .

in /usr/sbin i have all the postfix commands.

im not sure if its running or not, ps -e doesnt list postfix anywhere. do i need to start it? postfix check doesnt give me any errors either.

Last edited by rjcrews; 03-17-2005 at 09:07 PM.
 
Old 03-17-2005, 09:38 PM   #6
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
postfix, as far as I know, is a mail transport agent, not
a mail programme... try a simple
emerge mail



Cheers,
Tink
 
Old 03-18-2005, 01:50 PM   #7
rjcrews
Member
 
Registered: Apr 2004
Distribution: Debian
Posts: 193

Original Poster
Rep: Reputation: 30
emerge mail fails....

there are no ebuilds to satisfy 'mail'

may try perl
 
Old 03-31-2005, 10:09 AM   #8
packetz
LQ Newbie
 
Registered: Mar 2005
Posts: 5

Rep: Reputation: 0
try 'emerge mailx'
 
Old 03-31-2005, 10:32 PM   #9
rjcrews
Member
 
Registered: Apr 2004
Distribution: Debian
Posts: 193

Original Poster
Rep: Reputation: 30
I was able to get it working with perl, thx for the suggestions though.

had to emerge a dbi something or another.
 
Old 04-02-2005, 08:07 PM   #10
Dave Kelly
Member
 
Registered: Aug 2004
Location: Todd Mission Texas
Distribution: Linspire
Posts: 215

Rep: Reputation: 31
Try the command apropos with an argument of mail

And see what you get.
 
Old 08-04-2005, 09:59 AM   #11
rjcrews
Member
 
Registered: Apr 2004
Distribution: Debian
Posts: 193

Original Poster
Rep: Reputation: 30
mail: nothing appropriate

was the result.

still playing with the perl trying to get it how i like it... Thanks though!
 
Old 08-04-2005, 12:36 PM   #12
phil.d.g
Senior Member
 
Registered: Oct 2004
Posts: 1,272

Rep: Reputation: 154Reputation: 154
The mail program is normally part of the nail package or maybe the pine package
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Postfix send mail problem(In RH9, kernal 2.4.20, postfix 2.1.5) minor Linux - General 6 09-23-2019 10:09 PM
Postfix mail transfer agent not sending mail locally or to other servers sketelsen Linux - Software 3 02-09-2006 11:16 AM
problem receiving pop3 mail from postfix mail server GEN_Electric Linux - Software 2 02-14-2005 02:43 PM
Postfix $HOME/mail/inbox instead of /var/spool/mail ramram29 Linux - Software 3 08-08-2004 01:28 AM
Postfix mail server not accepting incoming mail from the external interface rexmundi Linux - Networking 7 12-22-2003 03:41 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:54 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration