Mail Server

Started by ziycon, June 13, 2016, 09:10:22 AM

Previous topic - Next topic

ziycon

I'm looking to spin up a centos 7.2 box for just handling mail from SMF, is there any suggestions on the best mail package to use? sendmail? postfix? Something else?

I'm looking for ease of setup and ease of maintenance as much as possible but don't mind getting my hands dirty if needed.

青山 素子

If you're building out just a relay, Postfix is super easy to set up and manage. Sendmail is pretty much discouraged nowadays except for legacy configurations.
Motoko-chan
Director, Simple Machines

Note: Unless otherwise stated, my posts are not representative of any official position or opinion of Simple Machines.


ziycon

It will be acting at the mail server for the domain, not just a relay, the MX record will be pointed to it also, is postfix a good fit for mail in and out and maintaining mail accounts?

青山 素子

Yeah, it's pretty solid. For use with IMAP and POP3, I'd pair it with Dovecot.
Motoko-chan
Director, Simple Machines

Note: Unless otherwise stated, my posts are not representative of any official position or opinion of Simple Machines.


ziycon

One last question, if I was to leave the MX record with my managed hosting and setup a new mail server to just handle out going mail for SMF, is there anything I need to do, will the server be blacklisted as the MX record doesn't point to it or can I have my manage hosted mail server handle all mail account and mail in and out and the new mail server just handle SMF out going mail.

The MX record server doesn't allow relaying through it.

青山 素子

Most of the time, you don't need the outgoing to be the same as the MX. Make sure you have proper forward and reverse DNS entries and that they match the HELO name the server uses. If you use SPF on your domain, add the server to that.
Motoko-chan
Director, Simple Machines

Note: Unless otherwise stated, my posts are not representative of any official position or opinion of Simple Machines.


ziycon


jaishreerawat

Sendmail and Postfix are indeed both Mail Transfer Agents (MTAs). But, mostly server administers prefer Postfix over sendmail as is is much secure, faster and easier for SMTP.

For POP3 and IMAP, dovecot is highly appreciated.

ziycon

#8
Finaly got around to setting this mail server up using postfix, now my issue seems to be that I cant get the web server running SMF to connect to the postfix server to send the mail out.

Error Message
QuotePHP message: PHP Warning:  mail(/var/log/php.log): failed to open stream: Permission denied in /var/www/html/testmail.php on line 30" while reading response header from upstream, client: xxx.xxx.xxx.xxx, server: www.example.com, request: "POST testmail.php HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.example.com", referrer: "http://www.example.com/testmail.php"

PHP Config
smtp = mail.test.local
smtp_port = 25

; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
; http://php.net/sendmail-path
;sendmail_path = /usr/sbin/sendmail -t -i

; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail().
;mail.force_extra_parameters =

; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename
;mail.add_x_header = On

; The path to a log file that will log all mail() calls. Log entries include
; the full path of the script, line number, To address and headers.
;mail.log =
; Log mail to syslog (Event Log on Windows).
mail.log = /var/log/php.log


I've added the servers IP into the postfix configuration under 'mynetworks', I can't see the traffic getting to the postfix server so I assume it's an issue with the PHP config?

Do I need to install postfix on the web server and point it to the postfix server acting as the mail server ort can I just tell PHP to send any mails from mail() to the postfix server?

Appreciate any help.

青山 素子

That particular error isn't from Postfix as far as I can tell. It looks like your PHP setup isn't allowed to read streams, so it's getting permission denied errors.

How is SMF configured to send mail? Are you specifically configured to use SMTP for sending?

Are you using Windows for PHP? The SMTP php.ini settings only apply to Windows setups.
Motoko-chan
Director, Simple Machines

Note: Unless otherwise stated, my posts are not representative of any official position or opinion of Simple Machines.


ziycon

Quote from: 青山 素子 on June 04, 2017, 03:56:32 PM
That particular error isn't from Postfix as far as I can tell. It looks like your PHP setup isn't allowed to read streams, so it's getting permission denied errors.

How is SMF configured to send mail? Are you specifically configured to use SMTP for sending?

Are you using Windows for PHP? The SMTP php.ini settings only apply to Windows setups.
Got it sorted, I wasn't sending the message-id in the headers so span assassin was giving the mails a minus rating.

It's a CentOs 7 box running just postfix.

A new issue popped up, the new mail server is only being used to send out mail from SMF, so all mail sends fine expect mail that is being sent to and email that has the same domain as the mail server so if the mail server is mail2.example.com any mail sent to @example.com is being delivered locally and not sent out externally.

Any ideas on how to stop this and for postfix to just send all mails externally?

青山 素子

Assuming you don't have it set, define mydomain as the full server name and reload Postfix. The default is to use myhostname and drop the left-most part; a server named host1.example.com would have mydomain set to example.com by default.
Motoko-chan
Director, Simple Machines

Note: Unless otherwise stated, my posts are not representative of any official position or opinion of Simple Machines.


ziycon

Quote from: 青山 素子 on June 05, 2017, 05:50:46 PM
Assuming you don't have it set, define mydomain as the full server name and reload Postfix. The default is to use myhostname and drop the left-most part; a server named host1.example.com would have mydomain set to example.com by default.
Fairplay, all working now.

My existing mail server (with the MX record) returned a 550 error as the mail address ([email protected]) I was sending from on mail2.example.com didn't exist so I have to create a mailbox for the noreply mail address for the mail to be received on my primary mail server that handles the mailboxes.

Advertisement: