LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   mail command settings (https://www.linuxquestions.org/questions/linux-newbie-8/mail-command-settings-760970/)

john_erlandsson 10-10-2009 07:46 AM

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

Nylex 10-10-2009 07:51 AM

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

set smtp=server

in your .mailrc, where server is your SMTP server.

unixanalyst 10-10-2009 07:52 AM

http://www.faqs.org/docs/gazette/mail.html

Nylex 10-10-2009 07:57 AM

Quote:

Originally Posted by unixanalyst (Post 3714507)

That doesn't appear to have anything to do with what the OP asked.

john_erlandsson 10-10-2009 08:35 AM

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

john_erlandsson 10-10-2009 08:46 AM

forget it... i removed the line set smtp-use-starttls (Uses SSL)
and now it works... thank you so much


//John

unixanalyst 10-11-2009 05:59 AM

Quote:

Originally Posted by Nylex (Post 3714513)
That doesn't appear to have anything to do with what the OP asked.

Apologies.


All times are GMT -5. The time now is 05:50 AM.