Jump to content
EduGeek EdSec 2026 is Go! 27th Oct in Derby! Join us for a day of EdTech security focused talks, networking, and an evening social ×

Recommended Posts

Posted

Hi,

 

I have setup an Ubuntu Web server. Its working a treat, only thing I need to do is setup php mail. This is so we can use an email form on the website. I have followed the below guide but it doesn't work. Can anyone spot any issues? The SMTP server works for other stuff and requires no authentication.

 

Anyone any suggestions please?

 

Thanks

 

postfix would be an overkill if you just need to send emails from php.

 

I personally use very simple and lightweight package ssmtp. It will use any smtp server to send outbound emails. Install it by running:

sudo apt-get install ssmtp

 

 

Then edit /etc/ssmtp/ssmtp.conf file, comment out existing mailhub line and add the following lines (this example is for gmail smtp server):

mailhub=mailhost.zen.co.uk:25

 

Now make sure that your php.ini has correct sendmail_path. It should read as:

sendmail_path = /usr/sbin/sendmail -t

 

 

Reload apache and your php should be able to send outgoing emails now.

Posted

I don't use ssmtp but this is our instructions for setting up ubuntu servers email (if you get nowhere with ssmtp - this should work). We have an exchange server which is the DC_SMARTHOST configured to relay from hosts with valid IP addresses (i.e. a known subset).

 

a. apt-get install exim4-daemon-light mailutils

b. edit the file /etc/exim4/update-exim4.conf.conf

dc_eximconfig_configtype='satellite'
dc_other_hostnames=[b]'this-serverfqdn'[/b]
dc_local_interfaces='127.0.0.1 ; ::1'
dc_readhost=[b]'base_fqdn'[/b]
dc_relay_domains=''
dc_minimaldns='false'
dc_relay_nets=''
dc_smarthost=[b]'IP of Internal Relay'[/b]
CFILEMODE='644'
dc_use_split_config='false'
dc_hide_mailname='true'
dc_mailname_in_oh='true'
dc_localdelivery='mail_spool'

 

c. sudo dpkg-reconfigure exim4-config (defaults should now be OK).

d. Test mail works by mail . (usze ctrl+D to terminate an input line).

  • Thanks 1
Posted

I haven't had to for moodle, wordpress, joomla etc but YMMV.

 

Have you checked your current set-up is able to mail from a command line? (last item on list).

Posted
Will have a check, does anything need to be on dc_relay_domains= (using your config?)

No. It should be just the items in bold you will need to change, i.e. :

 

dc_other_hostnames='this-serverfqdn'

dc_readhost='base_fqdn'

dc_smarthost='IP of Internal Relay'

Posted (edited)
right done that, but it doesn't work :( Message form the CLI and the wordpress site say sent but it doesn't arrive. Edited by FN-GM
  • 4 months later...
Posted
hi @pcstru

I am looking at setting up fail2ban https://www.digitalocean.com/community/tutorials/how-to-install-and-use-fail2ban-on-ubuntu-14-04

Using the configuration on this post what is the mail service name I should specify in the config file please?

Do you mean the mta setting or setting up fail2ban to monitor attempted connections to the exim relay?

 

Configuring Fail2Ban on DebianSqueeze | Kevin Deldycke

 

Might be of help.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...