LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-10-2009, 07:46 AM   #1
john_erlandsson
Member
 
Registered: Jul 2009
Location: Sweden
Distribution: Fedora
Posts: 70

Rep: Reputation: 1
mail command settings


Hi!

I want to be able to send an email using a shell script, with the mail command on my Fedora 11 box.

It seems easy enough, either simply typing:
#mail <address>
Subject: <subject>
<body>
.

or:
#mail -s "subject" "address" < ~/temp/body.txt


How do i assign an smtp server that the mail command can use to send emails?


//john

Last edited by john_erlandsson; 10-11-2009 at 06:41 AM.
 
Old 10-10-2009, 07:51 AM   #2
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
Did you try googling this? It's quite easy to do:

set smtp=server

in your .mailrc, where server is your SMTP server.
 
Old 10-10-2009, 07:52 AM   #3
unixanalyst
LQ Newbie
 
Registered: Sep 2009
Posts: 6

Rep: Reputation: 0
http://www.faqs.org/docs/gazette/mail.html
 
Old 10-10-2009, 07:57 AM   #4
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
Quote:
Originally Posted by unixanalyst View Post
That doesn't appear to have anything to do with what the OP asked.
 
Old 10-10-2009, 08:35 AM   #5
john_erlandsson
Member
 
Registered: Jul 2009
Location: Sweden
Distribution: Fedora
Posts: 70

Original Poster
Rep: Reputation: 1
thanks for helping..

i googled .mailrc and found that i should create a .mailrc file in my home folder.

I made one that looked like this (considering how i set up the account in a regular client)
Quote:
set verbose
set smtp-use-starttls (Uses SSL)
set smtp=send.one.com:2525
set from=robot@mydomain.se
set smtp-auth=login
set smtp-auth-user=robot@mydomain.se
set smtp-auth-password=password



this doesn't work... it gives me the output
Quote:
$ echo "test email" | mail "test subject" "john@mydomain.se"
Resolving host send.one.com . . . done.
Connecting to 195.47.247.201 . . . connected.
220 csmtp2.one.com ESMTP
>>> EHLO erlandsson
250-csmtp2.one.com
250-PIPELINING
250-SIZE 20480000
250-VRFY
250-ETRN
250-AUTH PLAIN LOGIN
250-AUTH=PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
>>> STARTTLS
502 5.5.1 Error: command not implemented
smtp-server: 502 5.5.1 Error: command not implemented
"/home/john/dead.letter" 10/299
. . . message not sent.
does this mean that it is impossible to use the mail command with my email provider?


//john

Last edited by john_erlandsson; 10-10-2009 at 08:41 AM.
 
Old 10-10-2009, 08:46 AM   #6
john_erlandsson
Member
 
Registered: Jul 2009
Location: Sweden
Distribution: Fedora
Posts: 70

Original Poster
Rep: Reputation: 1
forget it... i removed the line set smtp-use-starttls (Uses SSL)
and now it works... thank you so much


//John
 
Old 10-11-2009, 05:59 AM   #7
unixanalyst
LQ Newbie
 
Registered: Sep 2009
Posts: 6

Rep: Reputation: 0
Quote:
Originally Posted by Nylex View Post
That doesn't appear to have anything to do with what the OP asked.
Apologies.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Debian etch - Unable to send mail from command line or from php mail command lqforumuser Linux - Newbie 1 03-01-2009 06:56 AM
can mail command be used to send mail onto global mail servers like yahoo etc dale_chip Linux - Newbie 4 08-12-2008 08:33 AM
trouble importing mail and settings from Windows mail into Evolution austinium Linux - Newbie 2 06-20-2008 09:48 AM
command line email client to send mail to remote mail server dhanju Linux - Software 1 03-07-2008 06:37 AM
mail settings in linux mail command cad Linux - General 1 01-27-2007 04:23 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:40 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