+ Post New Thread
Results 1 to 10 of 10
*nix Thread, Setup PHP Mail in Technical; Hi, I have setup an Ubuntu Web server. Its working a treat, only thing I need to do is setup ...
  1. #1

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    15,815
    Thank Post
    873
    Thanked 1,674 Times in 1,457 Posts
    Blog Entries
    12
    Rep Power
    443

    Setup PHP Mail

    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.

  2. #2


    Join Date
    May 2009
    Posts
    2,902
    Thank Post
    259
    Thanked 768 Times in 583 Posts
    Rep Power
    269
    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
    Code:
    dc_eximconfig_configtype='satellite'
    dc_other_hostnames='this-serverfqdn'
    dc_local_interfaces='127.0.0.1 ; ::1'
    dc_readhost='base_fqdn'
    dc_relay_domains=''
    dc_minimaldns='false'
    dc_relay_nets=''
    dc_smarthost='IP of Internal Relay'
    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 <recipient>. (usze ctrl+D to terminate an input line).

  3. Thanks to pcstru from:

    FN-GM (27th May 2014)

  4. #3

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    15,815
    Thank Post
    873
    Thanked 1,674 Times in 1,457 Posts
    Blog Entries
    12
    Rep Power
    443
    Thanks, would I no have to but anything in php.ini? Thanks

  5. #4


    Join Date
    May 2009
    Posts
    2,902
    Thank Post
    259
    Thanked 768 Times in 583 Posts
    Rep Power
    269
    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).

  6. #5

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    15,815
    Thank Post
    873
    Thanked 1,674 Times in 1,457 Posts
    Blog Entries
    12
    Rep Power
    443
    Will have a check, does anything need to be on dc_relay_domains= (using your config?)

  7. #6


    Join Date
    May 2009
    Posts
    2,902
    Thank Post
    259
    Thanked 768 Times in 583 Posts
    Rep Power
    269
    Quote Originally Posted by FN-GM View Post
    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'

  8. #7

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    15,815
    Thank Post
    873
    Thanked 1,674 Times in 1,457 Posts
    Blog Entries
    12
    Rep Power
    443
    cheers just checking

  9. #8

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    15,815
    Thank Post
    873
    Thanked 1,674 Times in 1,457 Posts
    Blog Entries
    12
    Rep Power
    443
    right done that, but it doesn't work Message form the CLI and the wordpress site say sent but it doesn't arrive.
    Last edited by FN-GM; 27th May 2014 at 07:59 PM.

  10. #9

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    15,815
    Thank Post
    873
    Thanked 1,674 Times in 1,457 Posts
    Blog Entries
    12
    Rep Power
    443
    Actually it worked this time (me not wating!). Thanks for the help!
    Last edited by FN-GM; 27th May 2014 at 08:06 PM.

  11. #10


    Join Date
    May 2009
    Posts
    2,902
    Thank Post
    259
    Thanked 768 Times in 583 Posts
    Rep Power
    269
    No probs. Glad it worked for you.

SHARE:
+ Post New Thread

Similar Threads

  1. PHP Mailing System
    By 01hanstu in forum Web Development
    Replies: 8
    Last Post: 22nd March 2011, 07:18 PM
  2. javascript and php mail form
    By mikeglover in forum Coding
    Replies: 5
    Last Post: 19th January 2010, 01:32 PM
  3. Simple PHP mail save script
    By phpelite in forum Scripts
    Replies: 2
    Last Post: 1st December 2009, 12:56 AM
  4. PHP Mail
    By karldenton in forum Web Development
    Replies: 10
    Last Post: 15th May 2009, 07:25 PM
  5. PHP error on Manual WAMP setup
    By Nij.UK in forum Web Development
    Replies: 5
    Last Post: 28th March 2007, 09:47 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •