email - How to configure Postfix mail on Red Hat Linux?

12
2013-08
  • Questioner

    I am trying to configure Postfix on Red Hat Linux to send email with the following command:

    mail -s "test" [email protected]
    

    I have followed all the steps mentioned in this tutorial and have changed relay host configuration as follows:

    relayhost = 10.16.47.22
    

    where 10.16.47.22 is my mail server's IP address.

    But it doesn't work. The log file says:

    Mar 13 18:14:31 localhost postfix/smtp[3322]: warning:
    10.16.47.22[10.16.47.22]:25 offered null AUTH mechanism list
    Mar 13 18:14:31 localhost postfix/smtp[3322]: certificate verification failed for 10.16.47.2210.16.47.22]:25: untrusted issuer
    Mar 13 18:14:31 localhost postfix/smtp[3322]: 599C44A1AE9: to=, relay=10.16.47.22[10.16.47.22]:25,
    delay=9001, delays=9001/0.11/0.03/0, dsn=4.7.5, status=deferred
    (Server certificate not trusted)

    What could be the problem and how can I fix it?

  • Answers
  • Indrek

    First of all, if your system has a network connection and a local installed mailserver (e.g. Postfix, Sendmail or qmail), you can already send mail without a smart relay.

    If for some reason you need a smart relay, you must set it up as it should be. In your situtation your relay server demands SMTP auth with TLS. This means that you should set up your mail server (Postfix) to authenticate correctly with this relay.

    To sum up:

    1. Ensure that you provided the right "hostname user:password" in this command:

      echo "smtp.gmail.com smtp_user:smtp_passwd" > /etc/postfix/sasl_passwd
      
    2. Ensure that you have the crt key required and set the smtp_tls_CAfile parameter to its location, e.g.:

      smtp_tls_CAfile = /etc/pki/tls/certs/ca-bundle.crt
      

  • Related Question

    osx - How do I configure the built-in Postfix on Mac OS X to not connect directly to destination hosts other than itself?
  • Kevin Reid

    I run cron jobs on my Mac laptop, and so I want the mail daemon to be able to send the output mail to my regular mail account. I've got that working (my local account has a .forward file), but I'm often on networks where connecting to the destination's MX on port 25 doesn't succeed.

    Therefore, I would like to have the local mail daemon send its outgoing mail, regardless of the destination, to another SMTP server (which happens to be a SSH port-forward to a server under my control). How do I configure the Apple-supplied Postfix to do this?

    Update:

    I tried setting relayhost = [localhost]:40125 (where 40125 is the SSH port forward), but while I can now send mail to a proper Internet mail address (e.g. [email protected]), cron job mail (which is addressed to kpreid@<whatever the DHCP hostname is>) doesn't get delivered. From the one bounce I saw, it appears that this causes all mail, even for the local hostname, to go to the relayhost first.

    Therefore, I need a way to relay to [localhost]:40125 unless the address domain is this machine's domain (which varies frequently).


  • Related Answers
  • JanC

    You need to set the relayhost directive in /etc/postfix/main.cf (and maybe tweak some other settings, but that's hard to say without knowing the default config from Apple).