Sending mail from command line.
Dear all,
I would like to learn how to be able to send me mails from the command line. I have read a bit this guide: http://www.simplehelp.net/2008/12/01...-command-line/ and it when I try something like that mail -s “Hello world” you@youremailid.com < textToSend.txt the command line returns back, which means that the line is executed. but I do not receive any mails. I am not sure what is causing that . perhaps send mail is not installed . Please try to help me with the next steps but it should be a solution that will not interfere with my normal mails or make my system vulnerable to the outside world. I just need the mail for sending mails to my account. Regards Alex |
Try:
|
Well, if you got no error or msgs, it probably sent it to your mail server service on the same box.
What is your MTA/SMTP server; probably sendmail or postfix I'd guess. Check /var/log/maillog; also try Code:
mailq -AC |
Houston we have a problem
Code:
mailq -AC |
The 'mailutils' is installed successfully or not?
Try on terminal Code:
$ echo "mail-body" | mail -s "mail-subject" "receivers.address@linuxmail.com" If you still get this error. Uninstall and install postfix and try again. |
Quote:
Quote:
OP, in order for your system to send mail anywhere, you have to configure the mail system, and start it. It appears you haven't, or that the mail system you have is down. Are you using postfix or sendmail?? You can start them with either "/etc/init.d/postfix restart" or "/etc/init.d/sendmail restart". That will stop any running processes for those services, and start them back up again, and may correct your "mail system is down" problem. Mailx *CAN* work without either of those, but it also needs configuration, in order to know which other mail server to send your message TO. If you're in a company environment, chances are you already have a mail server. So, configure your mail system to use it as a smart host...there are MANY guides to do this for both postfix or sendmail. http://www.cyberciti.biz/faq/configu...-a-smart-host/ http://gopalthorve.com/install-postf...ure-smarthost/ The man page on the mailx command will tell you how to use either another IMAP or POP3 server to send your mail through: http://linux.die.net/man/1/mailx |
Sorry but no intention to put wrong information.
Once I got the same error.I kept the solution in my linux notes. I did following process and it was solved. I was getting Code:
mail postfix/postqueue[20397]: fatal: Queue report unavailable - mail system is down I was not able to send mails using terminal or apache (php mail function) I found it on one site to detect the error, it asked first what is the out put of Code:
mailq -AC It gave me Code:
mail postfix/postqueue[20397]: fatal: Queue report unavailable - mail system is down Code:
mailq -AC Code:
Mail queue is empty Code:
$ echo "mail-body" | mail -s "mail-subject" "receivers.address@linuxmail.com" |
Hi it was fixed by starting postfix. could you please let me know if I have to apply any specific security settings?
Regards Alex |
Quote:
|
All times are GMT -5. The time now is 05:34 PM. |