Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Server Operation

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 26th February 2009, 10:48
wintertong wintertong is offline
Junior Member
 
Join Date: Feb 2009
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default sendmail not working with PHP

Hi,

Can anyone help?

I have installed a new Ubuntu Server which is running Apache, MYSQL and PHP.

This server is not a mail server so I have changed my PHP.ini file to use the remote smtp server on port 25. I have saved this and restarted apache / php so that the changes take effect. I can see that they have been set in phpinfo.

The sendmail is being called from /usr/sbin/

I am calling the php function mail() which in turn runs sendmail. This was erroring with "sendmail: fatal: open /etc/postfix/main.cf: No such file or directory".

So I went into /etc/postfix/ and main.cf does not exist. I have these files in there:

-rw-r--r-- 1 root root 318 2009-02-24 19:20 dynamicmaps.cf
-rw-r--r-- 1 root root 4300 2009-02-24 19:20 master.cf
-rw-r--r-- 1 root root 18231 2008-09-03 15:28 postfix-files
-rwxr-xr-x 1 root root 7421 2008-09-03 15:28 postfix-script
-rwxr-xr-x 1 root root 22774 2008-09-03 15:28 post-install
drwxr-xr-x 2 root root 4096 2008-09-03 15:28 sasl

I assumed that I could take a copy of master.cf and call it main.cf Is this correct?

It did not work as now it says "sendmail: fatal: /etc/postfix/main.cf, line 22: missing '=' after attribute name: "smtp inet n - - - - smtpd". I do not know enough about this to fatham out what is wrong.

Help Please?!!

Is there something basic that I have forgot? Any help would be much appreciated.


Regards Gareth
Reply With Quote
Sponsored Links
  #2  
Old 27th February 2009, 08:59
topdog topdog is offline
Senior Member
 
Join Date: Jan 2008
Location: South Africa
Posts: 1,352
Thanks: 0
Thanked 153 Times in 150 Posts
Default

master.cf and main.cf have different formats you need an actuall main.cf file.
Try extracting it from the debian package. or setup a working one.
__________________
----
http://www.topdog.za.net - Got Linux problems ? - I can help.
http://www.baruwa.org - Try it.
Reply With Quote
  #3  
Old 27th February 2009, 10:36
wintertong wintertong is offline
Junior Member
 
Join Date: Feb 2009
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for this, I now have this main.cf file:

I ran this "aptitude install postfix" and then dpkg-reconfigure postfix. I ended up with a main.cf below.

I created a simple mail() php file and this time it did not error. It still did not send and email though.

# See /usr/share/postfix/main.cf.dist for a commented, more complete version


# Debian specific: Specifying a file name will cause the first
# line of that file to be used as the name. The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

readme_directory = no

# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

myhostname = server53009.uk2net.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = noreply@studio2online.co.uk, server53009.uk2net.com, localhost.uk2net.com, localhost
relayhost = 83.170.96.113
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 10
recipient_delimiter =
inet_interfaces = loopback-only
inet_protocols = all
Reply With Quote
  #4  
Old 27th February 2009, 10:50
topdog topdog is offline
Senior Member
 
Join Date: Jan 2008
Location: South Africa
Posts: 1,352
Thanks: 0
Thanked 153 Times in 150 Posts
Default

What errors do u see in the logs ?
__________________
----
http://www.topdog.za.net - Got Linux problems ? - I can help.
http://www.baruwa.org - Try it.
Reply With Quote
  #5  
Old 27th February 2009, 10:53
wintertong wintertong is offline
Junior Member
 
Join Date: Feb 2009
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default

There are no errors in the /opt/lampp/logs/error_log

Has postfix got its own error log? Sorry, never setup sendmail before. Always been installed ready.
Reply With Quote
  #6  
Old 27th February 2009, 10:55
topdog topdog is offline
Senior Member
 
Join Date: Jan 2008
Location: South Africa
Posts: 1,352
Thanks: 0
Thanked 153 Times in 150 Posts
Default

Yes postfix has its own log file usually /var/log/maillog
__________________
----
http://www.topdog.za.net - Got Linux problems ? - I can help.
http://www.baruwa.org - Try it.
Reply With Quote
  #7  
Old 27th February 2009, 10:55
wintertong wintertong is offline
Junior Member
 
Join Date: Feb 2009
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have just tried going to /usr/sbin/ and ran sendmail -t gareth.winterton@gmail.com -i test

This just hung
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
ffmpeg Video support for ubuntu 7.10 [suphp-ispconfig] amaurib Installation/Configuration 13 16th February 2010 17:26
ISP Config hesitation when opening web pages frankb Installation/Configuration 7 15th December 2008 13:06
ispconfig php 5 errors itamarjp Installation/Configuration 8 25th April 2008 10:20
network issues now it says "401 The web site is blocked by administrator" Check General 3 26th February 2008 14:22
Apache2 Freezes celtic Server Operation 31 28th May 2007 17:18


All times are GMT +2. The time now is 11:02.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.