Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Email server behind pfSense

    Scheduled Pinned Locked Moved NAT
    69 Posts 5 Posters 29.8k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • N
      nahid
      last edited by

      Marcelo,

      Please look at the screen shots of my Postfix Forwarder. I have done what you say about the sqlite but still it is empty.

      generaltabpf.png
      generaltabpf.png_thumb
      domaintabpf.png
      domaintabpf.png_thumb
      searchmailpf.png
      searchmailpf.png_thumb

      1 Reply Last reply Reply Quote 0
      • marcellocM
        marcelloc
        last edited by

        what you get on

        tail -f /var/log/maillog?
        and
        /usr/local/bin/php -q /usr/local/www/postfix.php 01min

        Treinamentos de Elite: http://sys-squad.com

        Help a community developer! ;D

        1 Reply Last reply Reply Quote 0
        • N
          nahid
          last edited by

          [2.0.1-RELEASE][root@pfsense.localdomain]/root(1): tail -f /var/log/maillog
          May 18 12:35:10 pfsense MailScanner[19799]: Using locktype = flock
          May 18 12:35:13 pfsense MailScanner[31018]: Connected to Processing Attempts Database
          May 18 12:35:13 pfsense MailScanner[31018]: Found 0 messages in the Processing Attempts Database
          May 18 12:35:13 pfsense MailScanner[31018]: Using locktype = flock
          May 18 12:35:19 pfsense MailScanner[37752]: Connected to Processing Attempts Database
          May 18 12:35:19 pfsense MailScanner[37752]: Found 0 messages in the Processing Attempts Database
          May 18 12:35:19 pfsense MailScanner[37752]: Using locktype = flock
          May 18 12:35:24 pfsense MailScanner[41484]: Connected to Processing Attempts Database
          May 18 12:35:24 pfsense MailScanner[41484]: Found 0 messages in the Processing Attempts Database
          May 18 12:35:24 pfsense MailScanner[41484]: Using locktype = flock

          [2.0.1-RELEASE][root@pfsense.localdomain]/root(1): /usr/local/bin/php -q /usr/local/www/postfix.php 01min
          /usr/bin/grep '^May 18 17:59.*(MailScanner|postfix.cleanup|postfix.smtp|postfix.error|postfix.qmgr)' /var/log/maillog
          writing to database…writing to database...24[2.0.1-RELEASE][root@pfsense.localdomain]/root(2):

          this are the execution data I got.

          "The second task that I am going to perform is that I will make a port forward on 25 from my external mail server ip to localhost. But question is my internal mail server ip is 10.10.1.5 and how will I connect this with external mail server. I mean how will the email traffic will receive and send between them?" – How I solve this?

          Thanks a lot for your reply.

          1 Reply Last reply Reply Quote 0
          • marcellocM
            marcelloc
            last edited by

            94.55.x.x will be an virtual ip on your pfsense?

            if so,
            just change 94.55.x.x on postfix gui to 10.10.1.5

            Internet –--> 94.55.x.x pfsense--->10.10.1.5 internal mail server

            You will have sqlite databases when you have mail traffic on logs

            Treinamentos de Elite: http://sys-squad.com

            Help a community developer! ;D

            1 Reply Last reply Reply Quote 0
            • N
              nahid
              last edited by

              Marcelo,

              I have changed following way:

              domainpftab.png
              domainpftab.png_thumb
              wanrules.png
              wanrules.png_thumb
              NATrules.png
              NATrules.png_thumb

              1 Reply Last reply Reply Quote 0
              • marcellocM
                marcelloc
                last edited by

                On port forward, create a nat rule from virtual ip 94.55.x.x to 127.0.0.1

                The port forward will create the rule you need on wan interface

                O postfix config, choose loopback and lan interface.

                Treinamentos de Elite: http://sys-squad.com

                Help a community developer! ;D

                1 Reply Last reply Reply Quote 0
                • N
                  nahid
                  last edited by

                  Dear Marcello,

                  Do I have to disable those port forward on 25 from ExternalMailServer to InternalMailServer or they will be there as like as they are?

                  1 Reply Last reply Reply Quote 0
                  • N
                    nahid
                    last edited by

                    recent status of the config:

                    loopback.png
                    loopback.png_thumb
                    portForward.png
                    portForward.png_thumb
                    rulesTab.png
                    rulesTab.png_thumb

                    1 Reply Last reply Reply Quote 0
                    • marcellocM
                      marcelloc
                      last edited by

                      @nahid:

                      Do I have to disable those port forward on 25 from ExternalMailServer to InternalMailServer or they will be there as like as they are?

                      yes, all external traffic must go to postfix (rdr from virtual ip to 127.0.0.1 with associated rule applied)

                      Treinamentos de Elite: http://sys-squad.com

                      Help a community developer! ;D

                      1 Reply Last reply Reply Quote 0
                      • N
                        nahid
                        last edited by

                        Hurrah!!!

                        Marcelo,

                        I can send emails but can't receive. Is there anything wrong?

                        1 Reply Last reply Reply Quote 0
                        • N
                          nahid
                          last edited by

                          these are log fıles:

                          2.0.1-RELEASE][root@pfsense.localdomain]/root(1): tail -f /var/log/maillog
                          May 18 22:04:28 pfsense postfix/postscreen[2216]: DISCONNECT [158.36.63.136]:234                                                                            25
                          May 18 22:04:28 pfsense postfix/postscreen[2216]: CONNECT from [158.36.63.136]:2                                                                            4689
                          May 18 22:04:28 pfsense postfix/postscreen[2216]: PASS OLD [158.36.63.136]:24689
                          May 18 22:04:29 pfsense postfix/smtpd[21666]: warning: 158.36.63.136: hostname e                                                                            x1-stud.diastud.corp verification failed: hostname nor servname provided, or not                                                                              known
                          May 18 22:04:29 pfsense postfix/smtpd[21666]: connect from unknown[158.36.63.136                                                                            ]
                          May 18 22:04:30 pfsense postfix/postscreen[2216]: NOQUEUE: reject: RCPT from [20                                                                            9.85.160.42]:36545: 450 4.3.2 Service currently unavailable; from=<tllkrmn+caf_=   ="" akaraman="sesric.org@gmail.com">, to=akaraman@sesric.org, proto=ESMTP, helo= <mai   ="" l-pb0-f42.google.com="">May 18 22:04:30 pfsense postfix/postscreen[2216]: PASS NEW [209.85.160.42]:36545
                          May 18 22:04:30 pfsense postfix/postscreen[2216]: DISCONNECT [209.85.160.42]:365                                                                            45
                          May 18 22:04:36 pfsense postfix/smtpd[21666]: NOQUEUE: reject: RCPT from unknown                                                                            [158.36.63.136]: 554 5.7.1 centre@sesrtcic.org: Relay access denied; from= <cla   ="" im@euromillionersdraw.com="">to= centre@sesrtcic.orgproto=ESMTP helo= <post.diast   ="" ud.corp="">May 18 22:04:46 pfsense postfix/smtpd[21666]: disconnect from unknown[158.36.63.                                                                            136]
                          May 18 22:08:07 pfsense postfix/anvil[21898]: statistics: max connection rate 1/60s for (smtpd:158.36.63.136) at May 18 22:04:29
                          May 18 22:08:07 pfsense postfix/anvil[21898]: statistics: max connection count 1 for (smtpd:158.36.63.136) at May 18 22:04:29
                          May 18 22:08:07 pfsense postfix/anvil[21898]: statistics: max cache size 1 at May 18 22:04:29
                          May 18 22:09:42 pfsense postfix/postscreen[10615]: CONNECT from [91.102.231.30]:19466
                          May 18 22:09:49 pfsense postfix/postscreen[10615]: NOQUEUE: reject: RCPT from [91.102.231.30]:19466: 450 4.3.2 Service currently unavailable; from=y.owadnqb@yahoo.com, to=webmaster@sesrtcic.org, proto=SMTP, helo= <freedom>May 18 22:09:49 pfsense postfix/postscreen[10615]: HANGUP after 0.48 from [91.102.231.30]:19466 in tests after SMTP handshake
                          May 18 22:09:49 pfsense postfix/postscreen[10615]: PASS NEW [91.102.231.30]:19466
                          May 18 22:09:49 pfsense postfix/postscreen[10615]: DISCONNECT [91.102.231.30]:19466</freedom>/webmaster@sesrtcic.org/y.owadnqb@yahoo.com</post.diast >/centre@sesrtcic.org</cla >/centre@sesrtcic.org</mai >/akaraman@sesric.org</tllkrmn+caf_= >

                          1 Reply Last reply Reply Quote 0
                          • N
                            nahid
                            last edited by

                            this is the log that email didn't receive.

                            May 18 22:12:02 pfsense postfix/postscreen[10615]: NOQUEUE: reject: RCPT from [209.85.213.42]:33824: 450 4.3.2 Service currently unavailable; from=nahid05@gmail.com, to=anhuda@sesric.org, proto=ESMTP, helo= <mail-yw0-f42.google.com></mail-yw0-f42.google.com>/anhuda@sesric.org/nahid05@gmail.com

                            1 Reply Last reply Reply Quote 0
                            • marcellocM
                              marcelloc
                              last edited by

                              If you have enabled the postscreen, the first communication for each ip will be rejected. Just like the spamd feature

                              Treinamentos de Elite: http://sys-squad.com

                              Help a community developer! ;D

                              1 Reply Last reply Reply Quote 0
                              • N
                                nahid
                                last edited by

                                Marcelo,

                                so what you recommend? If I disable the postscreen I will receive emails. Or there is any other solution.

                                1 Reply Last reply Reply Quote 0
                                • N
                                  nahid
                                  last edited by

                                  That means 2nd time sender will work properly. Am I right?

                                  1 Reply Last reply Reply Quote 0
                                  • marcellocM
                                    marcelloc
                                    last edited by

                                    @nahid:

                                    so what you recommend? If I disable the postscreen I will receive emails. Or there is any other solution.
                                    That means 2nd time sender will work properly. Am I right?

                                    Yes, try some sends to your domain.
                                    I use postscreen on my setups.

                                    att,
                                    Marcello Coutinho

                                    Treinamentos de Elite: http://sys-squad.com

                                    Help a community developer! ;D

                                    1 Reply Last reply Reply Quote 0
                                    • N
                                      nahid
                                      last edited by

                                      Marcelo,

                                      You are just awesome. I am really very much grateful to you. I have just started enjoying the pfSense. It is also just awesome like you.

                                      Thanks man for kind help.

                                      Nahid

                                      1 Reply Last reply Reply Quote 0
                                      • N
                                        nahid
                                        last edited by

                                        Marcello,

                                        There is problem with SMTP authentication when I want to send email to my network. Is there any pass rule where I can authenticate for my sesric.org emails.

                                        1 Reply Last reply Reply Quote 0
                                        • marcellocM
                                          marcelloc
                                          last edited by

                                          @nahid:

                                          There is problem with SMTP authentication when I want to send email to my network. Is there any pass rule where I can authenticate for my sesric.org emails.

                                          Id did not included authentication features to this package yet but you can paste these configs on custom field at postfix gui.

                                          As this is not anymore a nat question, use this topic for postfix questions, there are some auth config samples post by forum users there.

                                          http://forum.pfsense.org/index.php/topic,40622.0.html

                                          Treinamentos de Elite: http://sys-squad.com

                                          Help a community developer! ;D

                                          1 Reply Last reply Reply Quote 0
                                          • First post
                                            Last post
                                          Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.