Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Sending mail on command line.
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
josh
Guru
Guru


Joined: 05 Feb 2003
Posts: 473
Location: Milky Way: Solar System: Earth: North America: USA: NY: Buffalo

PostPosted: Wed Jan 25, 2006 3:08 pm    Post subject: Sending mail on command line. Reply with quote

I need a way to send mail from the command line to our company's mail server to be delivered. I'm assuming that this can be done since any mail client (pine,thunderbird,outlook) can do this. I just can't figure out the syntax.

The problem is that on our application servers there are cronjobs that kick out emails to customers using the machines local sendmail to send off the mail. Sometimes our customers mail servers will reject the emails because it can't identify the app server as being a valid originating mail server. Anything sent from our mail server never has a problem. So I'm thinking if I can change these crons to act as clients; delivering the mail to our mail server to be sent out from there, just as though I was using thunder bird, it would work. How can I accomplish this on the command line?

Thanks in advance!
_________________
-Josh
Back to top
View user's profile Send private message
msalerno
Veteran
Veteran


Joined: 17 Dec 2002
Posts: 1338
Location: Sweating in South Florida

PostPosted: Wed Jan 25, 2006 3:48 pm    Post subject: Reply with quote

Why not have sendmail relay off of the other mail server?
Back to top
View user's profile Send private message
josh
Guru
Guru


Joined: 05 Feb 2003
Posts: 473
Location: Milky Way: Solar System: Earth: North America: USA: NY: Buffalo

PostPosted: Wed Jan 25, 2006 4:22 pm    Post subject: Reply with quote

I'd love to. I just don't know how. And if it involves any changes on the mail server then I can't do it. Our mailserver admin is less than helpful. Even if I did all of the work. How would I go about doing that?
_________________
-Josh
Back to top
View user's profile Send private message
msalerno
Veteran
Veteran


Joined: 17 Dec 2002
Posts: 1338
Location: Sweating in South Florida

PostPosted: Wed Jan 25, 2006 4:49 pm    Post subject: Reply with quote

If you install ssmtp on the system running the cron jobs, you can easily setup relaying. If you are stuck on sendmail, read up on mail_hub
Back to top
View user's profile Send private message
GenTimJS
Guru
Guru


Joined: 03 May 2003
Posts: 406
Location: NH, USA

PostPosted: Wed Jan 25, 2006 4:55 pm    Post subject: pine? Reply with quote

pine is a terminal based mail sending client, you may be able to script it to send some stuff by CLI ?
_________________
-Tim Smith
Back to top
View user's profile Send private message
msalerno
Veteran
Veteran


Joined: 17 Dec 2002
Posts: 1338
Location: Sweating in South Florida

PostPosted: Wed Jan 25, 2006 6:36 pm    Post subject: Reply with quote

I know you can also do it with mutt i guess

echo hi | mutt msalerno@foo.bar
Back to top
View user's profile Send private message
josh
Guru
Guru


Joined: 05 Feb 2003
Posts: 473
Location: Milky Way: Solar System: Earth: North America: USA: NY: Buffalo

PostPosted: Wed Jan 25, 2006 7:06 pm    Post subject: Reply with quote

Yes, I am stuck with sendmail. I wasn't able to find anything on mail_hub but it did lead me to sendmail.mc. And it was alot easier than I thought. I just added the line:
Code:
define(`SMART_HOST',`smtp.mymailserver.com')

And now I can get email on my personal email account which I couldn't before. This also saves alot hassle because there are numerous scripts and programs which just call sendmail. Now I don't need to change them.

Thanks for all the help and suggestions guys!
_________________
-Josh
Back to top
View user's profile Send private message
mlybarger
Guru
Guru


Joined: 04 Sep 2002
Posts: 480

PostPosted: Fri Jan 27, 2006 11:53 am    Post subject: Reply with quote

i'm trying to figure out command line emails atm. i currently have qmail installed, and seems to be running. i can send an email out using:
Code:

echo "foo" | sendmail someone@somewhere.com

and the message arrives. i'd like to learn how to send attachments as well. it's particulary usefull for at work to be able to email someone quickly a config file or some such from one of the linux machines (though they're SUSE machines, it should be similar, no?)
Back to top
View user's profile Send private message
msalerno
Veteran
Veteran


Joined: 17 Dec 2002
Posts: 1338
Location: Sweating in South Florida

PostPosted: Fri Jan 27, 2006 1:45 pm    Post subject: Reply with quote

Code:
echo "My Xorg conf" | mutt -a /etc/X11/xorg.conf user@foo.bar
Back to top
View user's profile Send private message
josh
Guru
Guru


Joined: 05 Feb 2003
Posts: 473
Location: Milky Way: Solar System: Earth: North America: USA: NY: Buffalo

PostPosted: Fri Jan 27, 2006 2:32 pm    Post subject: Reply with quote

I have a program that generates excel-spreadsheet reports and emails them a-la sendmail (actually its a symlink from sendmail to postfix):
Code:
uuencode 12345.xls report-200601.xls |sendmail someone@somewhere.com

But the mutt looks a bit easier.
_________________
-Josh
Back to top
View user's profile Send private message
toralf
Developer
Developer


Joined: 01 Feb 2004
Posts: 3942
Location: Hamburg

PostPosted: Tue Oct 31, 2006 6:35 pm    Post subject: Reply with quote

josh wrote:
I have a program that generates excel-spreadsheet reports and emails them a-la sendmail (actually its a symlink from sendmail to postfix):
Code:
uuencode 12345.xls report-200601.xls |sendmail someone@somewhere.com

But the mutt looks a bit easier.
In which package is uuencde ?
Back to top
View user's profile Send private message
josh
Guru
Guru


Joined: 05 Feb 2003
Posts: 473
Location: Milky Way: Solar System: Earth: North America: USA: NY: Buffalo

PostPosted: Tue Oct 31, 2006 6:46 pm    Post subject: Reply with quote

I actually downloaded it from source (from god-knows-where now) and installed it. I see there is a package called uudeview:

http://www.gentoo-portage.com/app-text/uudeview

Which may or maynot have uu{en,de}code. It does have "uu" which looks like it might do something.
_________________
-Josh
Back to top
View user's profile Send private message
josh
Guru
Guru


Joined: 05 Feb 2003
Posts: 473
Location: Milky Way: Solar System: Earth: North America: USA: NY: Buffalo

PostPosted: Tue Oct 31, 2006 6:49 pm    Post subject: Reply with quote

I actually installed it and took a look. It has uuenview and uudeview. uuenview can be dropped in place of uuencode in the above example. I don't know where I was getting just "uu" from.
_________________
-Josh
Back to top
View user's profile Send private message
toralf
Developer
Developer


Joined: 01 Feb 2004
Posts: 3942
Location: Hamburg

PostPosted: Tue Oct 31, 2006 7:25 pm    Post subject: Reply with quote

josh wrote:
I actually installed it and took a look. It has uuenview and uudeview. uuenview can be dropped in place of uuencode in the above example. I don't know where I was getting just "uu" from.
Thanks, it works.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum