Setting up Ubuntu server to send mail

0

Can anybody point me in the right direction on how to set up my webserver so that the sites can send mail via phpmailer?

I have installed postfix using sudo apt-get

Then during the installation I selected internet site (which I think is the correct one)

If I select local only, will I still be able to send emails to say for example gmail.com, outlook.com addresses?

It then asks me for domain name, and this is the part I am struggling with as the server is connected to our work network and the sites on the server can only to be viewed by typing the ip address (for now) e.g. 192.168.0.223. what should I put here?

I have looked at a few other posts but none have helped me so far.

If you need any info from me about the server, just ask and I'll let you know. As not sure what you would need.

Steve

Posted 2013-12-17T11:14:27.223

Reputation: 11

Welcome to Superuser "Questions seeking product, service, or learning material recommendations are off-topic because they tend to become obsolete quickly. Instead, describe your situation and the specific problem you're trying to solve." did you have a specific issue setting it up? – 50-3 – 2013-12-17T11:53:12.467

"i have no idea what im doing or what any of the settings should be." Unfortunately, that's a bad place to start with regards to setting up a mail server, or any server for that matter. Specifically for email, it's how lots of spam gets sent these days, for one. Have you considered just pointing phpmailer at your ISP's outgoing mail server instead? – a CVn – 2013-12-17T13:41:12.117

i agree that its a bad place to start, but thought id have a go instead of paying a hosting company as the webserver wont be required access from outside.

also thanks for both of you for the replies i'd just got it to send shortly after i edited my posts. – Steve – 2013-12-17T14:09:50.193

Answers

1

IIRC the email server Ubuntu uses by default is exim4 and it's probably already installed. Use dpkg-reconfigure exim4-config from a root terminal.

From this (section 8.5.3):

If you would like your system to also handle external e-mail, you will need to reconfigure the exim4 package[22]:

# dpkg-reconfigure exim4-config

After entering that command (as root), you will be asked if you want split the configuration into small files. If you are unsure, select the default option.

Next you will be presented with several common mail scenarios. Choose the one that most closely resembles your needs.

and the text describes a couple options:

internet site

Your system is connected to a network and your mail is sent and received directly using SMTP. On the following screens you will be asked a few basic questions, like your machine's mail name, or a list of domains for which you accept or relay mail.

mail sent by smarthost

In this scenario your outgoing mail is forwarded to another machine, called a “smarthost”, which takes care of sending the message on to its destination. The smarthost also usually stores incoming mail addressed to your computer, so you don't need to be permanently online. That also means you have to download your mail from the smarthost via programs like fetchmail.

In a lot of cases the smarthost will be your ISP's mail server, which makes this option very suitable for dial-up users. It can also be a company mail server, or even another system on your own network.

mail sent by smarthost; no local mail

This option is basically the same as the previous one except that the system will not be set up to handle mail for a local e-mail domain. Mail on the system itself (e.g. for the system administrator) will still be handled. local delivery only

This is the option your system is configured for by default.

Since you are at a workplace, it sounds like you won't have an issue SMTP'ing email out of port 25. So you can select "internet site." Please note, however, you put your company at risk of being put on a blacklist should your PHP applications get misused for spam, etc. So, for an added layer of protection, you might want to set up an email account somewhere and use it as a smarthost during testing. Exim will then send outgoing email via this smarthost.

LawrenceC

Posted 2013-12-17T11:14:27.223

Reputation: 63 487