| Linode Forum https://forum.linode.com/ |
|
| Help installing Postfix on CentOS - Null Client https://forum.linode.com/viewtopic.php?f=11&t=5026 |
Page 1 of 1 |
| Author: | Chris Owens [ Thu Jan 07, 2010 4:43 pm ] |
| Post subject: | Help installing Postfix on CentOS - Null Client |
Hi, I'm using Google Apps to host my "proper" email for my users, however I need to enable sending of email on a couple of sites I have hosted on my Linode (CentOS 64Bit). I'd like to have it so that as I add more and more sites (and as my Linode grows) that all sites can take advantage of sending emails via PHP etc. I have zero requirements for my server to receive emails, I just need to send them via any scripts (99% of them PHP based) on the server and have no external clients be able to take advantage of Postfix (localhost only). From looking around I believe Postfix (as a null client) is the best way to go. However I am having trouble finding a good tutorial or advice on how I would achieve this, as most tutorials go all out to help me install a fully configured IMAP/POP3/WEBMAIL email hosting solution - not what I need. I would massively appreciate any assistance that anyone could offer. Many thanks, Chris |
|
| Author: | Chris Owens [ Thu Jan 07, 2010 4:46 pm ] |
| Post subject: | and one more thing... |
Additionally, I'd like the scripts to be able to send as if the emails where coming from any address. So that if I have a contact form, and that form is filled in - then the person enquiring effectively becomes the "from" address and when I and others receive the email we can simply hit reply. |
|
| Author: | 000 [ Thu Jan 07, 2010 5:56 pm ] |
| Post subject: | |
You can install postfix with: yum install postfix Then you need to take make a few minor config changes in /etc/postfix/main.cf Change the following parameters: myhostname - set to your server's hostname mydomain - set to your domain name I think you can get away with just that for outbound only. If you block incoming traffic to port 25 you don't need to worry about open relay issues (and postfix is pretty secure out of the box anyway). Then start it up with: service postfix start That should be all you need... if you want to wrap scripts around the mail command and it's not there try running yum install mailx (can't remember if it will be there already off the top of my head). Hope this helps |
|
| Author: | Vance [ Thu Jan 07, 2010 6:18 pm ] |
| Post subject: | |
You can configure Postfix as a null client. If you need to authenticate with the mail relay, enable client SASL. On Ubuntu 8.04, Postfix is already linked with the Cyrus libraries; don't know about CentOS. |
|
| Author: | Chris Owens [ Thu Jan 07, 2010 6:41 pm ] |
| Post subject: | |
000 - Thank you - I did what you said and all seems to be working fine. Vance - As I'd already followed 000's instructions and it seems to be working as intended - is there anything that I should look at from the links you provided? Finally, having just followed 000's instructions (only edited the 2 entries) is there anything else I need to/can disable to optimise the memory/cpu usage of postfix? Thank you both again - linode and it's community is amazing. Regards, Chris |
|
| Author: | 000 [ Thu Jan 07, 2010 6:52 pm ] |
| Post subject: | |
I had a quick look at the link Vance posted to the Postfix manual - looks ok (some are optimizations, e.g. listening on loopback only...read the notes below it to see if you feel any line of the config would be better for your needs). Optimization wise you shouldn't need to do anything, Postfix is very lightweight in this kind of setup. |
|
| Author: | Vance [ Thu Jan 07, 2010 7:22 pm ] |
| Post subject: | |
As 000 notes, it's probably worthwhile to set "inet_interfaces = loopback-only" in /etc/postfix/main.cf. This is a bit more robust than using a firewall to block outside connections. My other references were for a slightly different type of setup than you seem to be using. Also note that many programs will send error reports to root. If you don't plan to read mail locally on your Linode, you'll probably want to edit /etc/aliases to direct mail for root to your real e-mail address. Don't forget to run newaliases after making your edits. You'll want to be careful about letting people send arbitrary messages via a web page where they get to pick the "To:" address - this can easily cause you to become a spam source. |
|
| Author: | Chris Owens [ Thu Jan 07, 2010 7:42 pm ] |
| Post subject: | |
Hi 000 & Vance, I've made the loopback change and suggested - is there anyway to check if the alias modification and newaliases worked or do I need to wait till something tries? Thank you both again for you advice. Regards, Chris |
|
| Author: | Vance [ Sat Jan 09, 2010 7:54 pm ] |
| Post subject: | |
You should be able to test whether mail to root works by running the following command on your Linode. Code: $ /usr/sbin/sendmail -t If it works, you'll get a message at the address you set the alias to with the subject "Test" and the body "testing 123". You can also look in your mail logs to see that the message was delivered (or delivery was attempted). |
|
| Author: | Chris Owens [ Mon Jan 11, 2010 3:22 pm ] |
| Post subject: | |
Hi Vance, Well the scripts are working correctly, however the aliasing isnt. Here is what I have: Maillog: The last entries are: Code: Jan 11 18:46:04 li140-172 postfix/pickup[31811]: 5302D3B231: uid=0 from=<root> Looking at the above - I notice that it says there is no A record for babygirl.twenty4.org - which is correct, I haven't setup an A record for "babygirl" - do I need to? aliases I left everything else the same and modified the last time to read: Code: root: me@myemailaddress.com main.cf I changed the entries you said to say: Code: myhostname = babygirl I entered babygirl for myhostname (as thats what I have in in my /etc/hostname - which I did after following this tutorial). And twenty4.org is one of the sites I'm running on my linode. I ran newaliases after making the change and have also reloaded postfix. Have I done anything incorrectly? Any advice is appreciated. Thanks, Chris |
|
| Author: | sweh [ Mon Jan 11, 2010 10:41 pm ] |
| Post subject: | |
Chris Owens wrote: Code: myhostname = babygirl I think that should the full domain name, not the local name. What's the output of "postconf"? On my machine it shows the fully qualified domain name (FQDN) for "myhostname". |
|
| Author: | Chris Owens [ Tue Jan 12, 2010 6:23 pm ] |
| Post subject: | |
sweh - that worked - just did a quick test and recieved the test email to "root". I set $myhostname to: server.twenty4.org One last question - the to/from address of the email I received appears as - "root@server.twenty4.org" - is there a way of changing this to something more friendly (e.g. linode@twenty4.org)? Many thanks again to all for your help. Regards, Chris |
|
| Author: | Xan [ Wed Jan 13, 2010 12:31 am ] |
| Post subject: | |
Do you plan on doing a lot of emailing from the command line? |
|
| Author: | Chris Owens [ Wed Jan 13, 2010 2:48 pm ] |
| Post subject: | doh! |
Xan wrote: Do you plan on doing a lot of emailing from the command line? I see what you mean...
I just checked mailing through a PHP script and it honours the from address and doesn't use "root@server.twenty4.org". Thanks for your help and apologies for my ignorance on this last issue. Best regards, Chris |
|
| Page 1 of 1 | All times are UTC-04:00 |
| Powered by phpBB® Forum Software © phpBB Group http://www.phpbb.com/ |
|