Linux / UNIX Tech Support Forum
This is a discussion on Mailing from my Local Linux system within the Linux software forums, part of the Linux Getting Started category; I have never configured "mail" on linux. Now I need to use a script to email me a report once ...
|
|||||||
| Linux software General questions and discussion about Redhat/Fedora Core/Cent OS, Debian and Ubuntu Linux related to softwares should go here. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
I have never configured "mail" on linux. Now I need to use a script to email me a report once every day. Till now, I have been using Thunderbird and use the SMTP /IMAP server in my campus to send and receive mail
I want to know how to use the mail command from the command line to send mails. I mean, I have an email account in a server mail.mydomain.net and how do I configure "mail" to use it. The smtp port is on port 991. I have tried to just use this: Code:
mail -s "test mail" ricc@yahoo.com < ~/outputfile http://forum.cyberciti.biz/mail-serv...hlight=postfix My postfix daemon can ping the server and can telnet to the said port. But the /var/log/mail indicates connection timeout. I want to know how to enable mailing and also if I need to use a local SMTP server on my PC. I would like to avoid using this becoz I already have an account on my main email server and would like to use that. ricc |
| Sponsored Links | ||
|
|
|
|||
|
My primary objective is to have my system mail the log file, that a script creates, to an external email id - ricc@yahoo.com.
I already have a campus-wide email id ( ricc@mydomain.net ) in my campus email server. What I want is, to be able to send this log file as mail to ricc@yahoo.com from my account ricc@mydomain.net. I am not sure if I have been able to make you all understand what I want. But if you have not understood what is my objective, I would like to say that I want to know how to use simple email from the command line. That means...I would like to use my email account in the email server to send a file from my local system ( mainly from the command line ). I dont want to use something like root@mypc.mydomain.net to send messages ( which unfortunately, I have not been able to do so also) ricc |
|
||||
|
Quote:
First, you need working mail null client (which will forward mail from local workstation/server to real mail server). In your case all you need to do is tell your mail server to route mail using your mailserver. For example add following line to sendmail /etc/mail/mailertable Code:
127.0.0.1 smtp:p5smtpout.mymailserver.net p5smtpout.mymailserver.net For postfix edit /etc/postfix/main.cf and add/append line: Code:
relayhost = p5smtpout.mymailserver.net |
|
|||
|
Thanks monk,
I found something that I want to share. I have found that we can configure mail (or nail) to use .mailrc file in my home directory to use my campus email server to send and receive mail. Here it is something that I found in this site: http://<br /> <br /> <a href="http...<br /> <br /> I have input my imap and smtp server settings and the password in the file: Code:
set folder=imap://ricc@172.16.0.201 set smtp=smtp://172.16.0.201 set from="ricc@mydomain.net( RICC )" #set smtp_use_starttls set smtp-auth=login set smtp-auth-user=ricc set smtp-auth-password=password Code:
mypc:~ # mail -v -s "test msg" ricc@yahoo.com <~/testmail Code:
Resolving host 172.16.0.201 . . . done. Connecting to 172.16.0.201 . . . connected. 220 mx1.mydomain.net ESMTP >>> EHLO mypc.mydomain.net 250-c2a.mydomain.net 250-PIPELINING 250-SIZE 15000000 250-ETRN 250-STARTTLS 250 8BITMIME >>> AUTH LOGIN 530 Must issue a STARTTLS command first smtp-server: 530 Must issue a STARTTLS command first . . . message not sent. Code:
530 Must issue a STARTTLS command first Code:
set smtp_use_starttls ricc[/code] |
|
||||
|
Few years back i was using something as follows in my shell script:
Code:
MAILRC=/dev/null from=you@domain.com smtp=smtp.mail.com \
smtp-auth-user=smtpUser smtp-auth-password=smptUser \
smtp-auth=login nail -n -s "My Subject" \
-a /tmp/somefile.tar.gz outside@gmail.com < /tmp/message.tmp.out
__________________
Rocky Jr. What's wrong? I hope I am not making you uncomfortable... Never send a boy to do a mans job. |
|
||||
|
Your config should be as follows:
Code:
vi .mailrc Code:
account myisp {
set folder=imap://ricc@172.16.0.201
set smtp=smtp://172.16.0.201
set from="ricc@mydomain.net( RICC )"
set smtp-use-starttls
set smtp-auth=login
set smtp-auth-user=ricc
set smtp-auth-password=password
}
Code:
nail -A myisp -v -s 'test' out@gmail.com
__________________
Rocky Jr. What's wrong? I hope I am not making you uncomfortable... Never send a boy to do a mans job. |
|
|||
|
Thanks rocky,
I have done as you said. I am getting a new error Code:
ricc@mypc:~> nail -v -s 'test' ricc@yahoo.com Test Messages EOT Resolving host 172.16.0.201 . . . done. Connecting to 172.16.0.201 . . . connected. 220 mx1.mydomain.net ESMTP No SSL support compiled in. . . . message not sent. Code:
Unknown command: "}" But I think the error "No SSL support compiled in" is due to SSL support not compiled into the nail program. Pls help me. ricc |
|
|||
|
As i look, you have a problem with your accuracy from what you have to do. I also a newbie, but with a bit effort i able to make the system to send email from the log. Please check your ".mailrc" script. And make sure, that your configuration of your mail account is right.
Here is as example's os the log that show you how it success to send the log to your email. ++++++++++++++++++++++++++++++++++++++++++++++ local:/home/personal # mail -A nameaccount -v -s 'test' christeddy.parapat@mtbintl.com < /var/log/messages Resolving host my.mail.net.id . . . done. Connecting to 202.122.60.12 . . . connected. 220-my.mail.net.id ESMTP Exim 4.69 #1 Mon, 22 Feb 2010 00:57:34 +0700 220-We do not authorize the use of this system to transport unsolicited, 220 and/or bulk e-mail. >>> EHLO local.workgroup.com 250-web1-cpn.biz.net.id Hello local.workgroup.com [202.51.11.101] 250-SIZE 15728640 250-PIPELINING 250-AUTH PLAIN LOGIN 250-STARTTLS 250 HELP >>> AUTH LOGIN 334 VXNlcm5hbWU6 >>> Y19wYXJhcGF0QGtsaWtteXRpbWUuY29t 334 UGFzc3dvcmQ6 >>> NTgwMTQy 235 Authentication succeeded >>> MAIL FROM:<testsend@mail.com> 250 OK >>> RCPT TO:<log@yahoo.com> 250 Accepted >>> DATA 354 Enter message, ending with "." on a line by itself Test. >>> . 250 OK id=1NjG3i-0000hr-VO >>> QUIT 221 my.mail.net.id closing connection +++++++++++++++++++++++++++++++++++++++++++++++ Thank you Rockdalinux.. http://1.1.1.5/bmi/nixcraft.com/imag.../icon_wink.gif Quote:
|
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| creating a group mailing list on linux | sunguru | The Hangout | 1 | 07-06-2008 02:49 PM |
| Error while logging in the linux system | vaibhav.kanchan | Getting started tutorials | 2 | 19-07-2007 09:27 PM |
| code for connecting two linux system | narasimha.reddygnv | Shell scripting | 1 | 27-03-2007 10:23 AM |
| Linux krefilld process and what is it doing on my system? | sweta | Linux software | 1 | 31-08-2006 01:16 AM |
| linux gather system information | Linux software | 3 | 24-01-2006 06:45 PM | |