5

This may be a lame question..

All the time I was using postfix to send mails via my rails app. I just install postfix via these commands, cause i never really thought about the what actually going in this postfix thing. I was more concerned about the application of the code and all.

  sudo apt-get install postfix
  sudo apt-get install bsd-mailx

If you use postfix, then you fix it quickly by disabling tls by setting “smtpd_use_tls=no” in /etc/postfix/main.cf

sudo /etc/init.d/postfix start

Thats it. My rails app automatically start sending mails for me via postfix. But now i need smtp settings for this postfix. How can i find out that? Can anybody tell me?

EDIT

I am looking for SMTP Hostname, SMTP Username, SMTP Password, Port(Its 25 for default)

2
  • 3
    there are more than 700 postfix configuration parameters in. 95 of these are for configuring smtp sending rules. maybe you can be a little more explicit about what you need to do?
    – user237419
    Nov 9, 2011 at 8:09
  • @adirau check edit part..
    – Mohit Jain
    Nov 9, 2011 at 9:55

4 Answers 4

-3

Mail postfix configuration file is /etc/postfix/main.cf. Default one (most probably you have default file there) is well-commented and describes defaults for most of the parameters listed there (that's not all params, but it's a good start).

I'd suggest reading this file together with postfix documentation.

BTW, what problem you are actually trying to solve? It's often not necessary to touch any postfix config for just sending mail from localhost.

2
  • This doesn't answer the question.
    – ki9
    Feb 14, 2017 at 0:10
  • they are not asking how to set the settings, but what the settings are.
    – Tony B
    May 22, 2019 at 17:26
12

This ma be a lame answer:

You can find out the default configuration by postconf -d this is what Postfix assumes if you have no configuration. But you asked for the defaults!

If you want to find out the current(!) configured settings then you can do this with postconf -n.

When you then need to know what each setting means then you are guided to read the explanation at http://www.postfix.org/postconf.5.html

1
  • This one comes closest the answering the question.
    – Tony B
    May 22, 2019 at 17:27
2

You must to open port 25 on firewall for smtp. In next link you can find basic configuration for postfix. http://www.postfix.org/STANDARD_CONFIGURATION_README.html

2
  • How to do that?? Can u guide me??
    – Mohit Jain
    Nov 9, 2011 at 9:54
  • @MohitJain NO! How should we know what firewall you have. And even if we know, this is not related to your original question. And even if you open a new question asking that: This is no help forum.
    – mailq
    Nov 9, 2011 at 13:46
2

ok, so you have a default postfix install and one piece of r0r app that must be configured to send emails. I will assume you will install postfix on the same server you are running your ror application. If you are planning to host the postfix install on a remote server, don't. I advise on using a local postfix installation as described below, mostly for security purposes.

to make sure you installed postfix correctly do a fresh postfix install IF and only if you are ok with completely deleting the current postfix installation. If you're not ok with this just skip to __postfix_configuration_checks paragraph.

apt-get purge postfix
apt-get install postfix

On debian (and I guess on ubuntu as well) the installer will ask you how do you want to use postfix. choose "local only". That is, "the only delivered mail is the mail for local users", just as a security measure.

when the install process finishes you should have a postfix instance listening on localhost, port 25, allowing mail sent from localhost to be queued unconditionally (default settings)

__postfix_configuration_checks

you can check the policies by running postconf like this:

postconf smtpd_recipient_restrictions mynetworks

and the output you will see should be the same with:

smtpd_recipient_restrictions = permit_mynetworks, reject_unauth_destination
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128

you should also (double-) check that your postfix is listening only on loopback interface, port 25:

netstat -nltp  |grep master
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      4713/master     

now you're ready to configure your rail app:

hostname='localhost' #or '127.0.0.1'
port=25
password='' #or nil, dunno
username='' #or nil?

you should be able to send emails from your ror app thru your postfix install

1
  • 2
    don't "purge" the current postfix install unless you're ok to loose the current postfix files and configuration. purging and reinstalling is the easy way to make sure postfix will run as you need for local clients, since debian/ubuntu gives preconfigured usecase installs and it will save you time from reading a lot of documentation and messing with main.cf
    – user237419
    Nov 9, 2011 at 10:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .