How to send automatic emails to user
Hello.
I'm trying to send an automatic email to system users when there jobs are done on a queue. I've used sendmail but the program sends the messages to /var/spool/mail/<user> and not the user's real email address: user@somewhereelse.com. Since I only want simple outbound emailing I don't think I need a full-blown email-server (perhaps I'm wrong). Is there a simple way to send email to users? The system I'm using is CentOS 5.0 32bit. All advice is appreciated. Thanks. |
use the mail program...
Code:
echo "You have a job X done" | mail -s "your job at queue X is done" user@somewhereelse.com Code:
mail -s "your job at queue X is done" user@somewhereelse.com <<EOM |
Quote:
I tried this with the mail -v option to get verbose info. This is what I got to the screen: Code:
user@somewhere.com... Connecting to [127.0.0.1] via relay... Any suggestions on what's wrong and how to fix it? |
what is the status of sendmail? If it's stop, you need to start it with this
service sendmail start |
You were right cojo, Sendmail service was off.
I started there service and tried again. This is what I got... Code:
echo "Test email" | mail -v -s "ws email" user@somewhere.com |
In fact, it is correct. The normal behaviour is to connect to the localhost to delivery e-mail generated locally.
The localhost can be configured to send e-mails directly or to connect to a relay host to send e-mails. In my setup here at work, I have this working in this way. The several servers can send e-mails directly and only the mailserver can accept incoming e-mails. It is up to you. I can't help you with sendmail, because I use postfix for years. In postfix there is a configuration file named transport where I set for what domains I can send e-mails directly or for what domains I need to relay e-mails. I hope this can help, |
You don't need to do anything at all. Just make sure your sendmail is enable and started. It's working right now. As long your company mail server will except mail from your Fedora box.
|
All times are GMT -5. The time now is 02:50 AM. |