2

I am trying to send an email to my thunderbird or google acount using PHP from a local server in Ubuntu. I have used the mail() function in PHP.

I have done some research and apparently you can not send an email from the local server unless you install an email system. So I went with postfix and installed it:

sudo apt-get install postfix

For the configuration I chose Satellite. I don't know how to proceed from here.

What should I type for System mail name, is localhost correct?

I left SMTP relay host and Root and postmaster mail recipient: blank.

I am very much confused and could not find any step by step tutorial. I would appreciate any help and some clarification on how to finish the steps in postfix configuration.

Edit: I looked at this https://help.ubuntu.com/community/Postfix

But why System mail name: example.com and why we choose General type of mail configuration: Internet Site?

Jack
  • 161

1 Answers1

0

In short: choose Internet Site as a configuration and use fqdn for Mail System name (if you use localhost it will be classified as spam most likely).

Problem is, for some of the mail servers nowadays it will not be enough (for example, gmail tends to classify such configuration as spam).

What else will you need:

  • MX DNS record (a DNS record, that will point to appropriate IP as a Mail target for given domain - you can check it with host -t MX domain)
  • postconf -e "myhostname = [hosts fqdn]"
  • postconf -e "myorigin = \$myhostname"