Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Problems sending Email through PHP  (Read 8642 times)

0 Members and 1 Guest are viewing this topic.

Zylstra

    Topic Starter
  • Moderator


  • Hacker

  • The Techinator!
  • Thanked: 45
    • Yes
    • Technology News and Information
  • Certifications: List
  • Computer: Specs
  • Experience: Guru
  • OS: Windows 7
Problems sending Email through PHP
« on: October 24, 2007, 09:38:05 AM »
None of my PHP Applications can send out emails. I am using PHP5.

I have no idea what to do. I suspect I have a configuration completely messed up, but I have no idea how to repair it. I have PostFix installed, a SMTP program. I have no idea what settings I should use. I would expect that SMTP has taken the same information that I use to log in to SSH/terminal, which is the username "server" and a password I am not going to tell you... (duh)

I have tried manual settings in SMF using default ports, I tried "localhost" and the server IP address for location.

Ubuntu 7.04 (soon to be updated, I am sure)
PHP5
Kernel Version 2.6
APT-GET functions available.

What shall I do?
Thanks,
Zylstra

michaewlewis



    Intermediate
  • Thanked: 26
    • Yes
    • Yes
  • Experience: Expert
  • OS: Unknown
Re: Problems sending Email through PHP
« Reply #1 on: October 24, 2007, 11:17:54 AM »
Do you really have to have smtp installed to send mail with php? I always thought php was the smtp. :-\ Of course I've never tried sending mail from a server I set up myself. Just from paid hosting.

You sure you're php coding is correct? Show an example. I'll see if I notice anything.
Can you access your webserver at all with a browser?

Zylstra

    Topic Starter
  • Moderator


  • Hacker

  • The Techinator!
  • Thanked: 45
    • Yes
    • Technology News and Information
  • Certifications: List
  • Computer: Specs
  • Experience: Guru
  • OS: Windows 7
Re: Problems sending Email through PHP
« Reply #2 on: October 24, 2007, 05:26:27 PM »
Well, I tried just using the PHP send mail feature, but it didnt work...
So, I tried installing SMTP (PostFix)
That didnt work either.
I am using an SMF Forum, so all code is correct (If ComputerHope forums can send emails using the same code, I expect everything is alright)

PHP Error reporting is enabled, so any errors would be displayed.

I can access my webserver in my web browser (sorry, for security reasons, I cant really give you the link)

michaewlewis



    Intermediate
  • Thanked: 26
    • Yes
    • Yes
  • Experience: Expert
  • OS: Unknown
Re: Problems sending Email through PHP
« Reply #3 on: October 24, 2007, 06:31:39 PM »
Did you use xampp to set up everything or did you do everything yourself? Check php.conf to see if email is enabled.

Zylstra

    Topic Starter
  • Moderator


  • Hacker

  • The Techinator!
  • Thanked: 45
    • Yes
    • Technology News and Information
  • Certifications: List
  • Computer: Specs
  • Experience: Guru
  • OS: Windows 7
Re: Problems sending Email through PHP
« Reply #4 on: October 24, 2007, 06:39:12 PM »
I am running Ubuntu Server Edition, and installed a lot of my applications manually, which took longer than the promised full 15 minute server instalation...

What am I looking for exactly in php.conf ?

michaewlewis



    Intermediate
  • Thanked: 26
    • Yes
    • Yes
  • Experience: Expert
  • OS: Unknown
Re: Problems sending Email through PHP
« Reply #5 on: October 25, 2007, 10:50:00 AM »
What am I looking for exactly in php.conf ?

Open it in kate, joe, vim or whatever text editor you like and find the [mail function] section and check the settings in it to make sure everything is set correctly and the paths are pointing to the right place.
Before editing it, make sure you make a backup copy. ;)

(Sorry if some of my suggestions don't work right. In all honesty I haven't had linux installed on my main machine in several months :o )

Zylstra

    Topic Starter
  • Moderator


  • Hacker

  • The Techinator!
  • Thanked: 45
    • Yes
    • Technology News and Information
  • Certifications: List
  • Computer: Specs
  • Experience: Guru
  • OS: Windows 7
Re: Problems sending Email through PHP
« Reply #6 on: October 26, 2007, 05:08:11 PM »
Where is PHP.conf ? All I can find is php.ini

michaewlewis



    Intermediate
  • Thanked: 26
    • Yes
    • Yes
  • Experience: Expert
  • OS: Unknown
Re: Problems sending Email through PHP
« Reply #7 on: October 26, 2007, 05:52:55 PM »
Sorry, you're right, it's php.ini. I got it confused with http.conf  :-[

Zylstra

    Topic Starter
  • Moderator


  • Hacker

  • The Techinator!
  • Thanked: 45
    • Yes
    • Technology News and Information
  • Certifications: List
  • Computer: Specs
  • Experience: Guru
  • OS: Windows 7
Re: Problems sending Email through PHP
« Reply #8 on: October 26, 2007, 06:18:11 PM »
Relevant information:
Code: [Select]

[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25

; For Win32 only.
;sendmail_from = [email protected]

; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
;sendmail_path =

; Force the addition of the specified parameters to be passed as extra paramete$
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail(), even in safe mode.
;mail.force_extra_parameters =



michaewlewis



    Intermediate
  • Thanked: 26
    • Yes
    • Yes
  • Experience: Expert
  • OS: Unknown
Re: Problems sending Email through PHP
« Reply #9 on: October 29, 2007, 10:42:08 AM »
tell it what the path is to your smtp program at the line "sendmail_path = " and also get rid of the ";" to uncomment it
I'm not sure if you have to use sendmail for the smtp program, or if postfix will work, but it's worth checking into. It probably works with any smtp. :-\