sending email with php

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Im new to php (as of this weekend)
I have an app setup which sends an email. I'm using php and mysql on
I'm a little confused how to setup the smtp mail servers in the
php.ini file (this is where I set it up right?)

Im sure I have the actual php code correct in my page, and it is the
mail server settings thats creating the problems.

Thanks for your time

Re: sending email with php


on 01/15/2008 12:14 AM B said the following:
Quoted text here. Click to load it

It depends. You only need to setup SMTP servers under Windows. Under
Linux/Unix messages are not relayed on SMTP servers.

Are you having difficulties to have your messages sent with the mail()
function? What operating system are you using in your Web server machine?


Manuel Lemos

PHP professionals looking for PHP jobs

PHP Classes - Free ready to use OOP components written in PHP

Re: sending email with php

B wrote:
Quoted text here. Click to load it

You should just be able to use sendmail with the mail(); command.

Try this

mail('','Testing Email','Hello!','From:');

this is enough for a basic sending of mail, and can be used for more  
complex emails too using the 4th parameter of headers.

Daniel Ennis - Quality Web Hosting and Ventrilo Services
System Administrator / Web Developer
PHP Developer for 6 years

Re: sending email with php

B wrote:

Quoted text here. Click to load it

On non-Windows servers, PHP does not send mail through SMTP -- it uses the  
sendmail binary.  

This means you need to install the "sendmail" package, or any other mail  
transfer agent that is sendmail-compatible. Indeed, sendmail is pretty  
hard to configure and can very easily create big security headaches for  
you, so I'd recommend use a compatible MTA instead.  

I use Postfix, but that's because I need to receive mail too. If you are  
sure that this server only needs to send mail, then Nullmailer might be a  
better choice.

I don't use Ubuntu, but I'd be willing to bet that it includes a Postfix  
package, and probably a Nullmailer one too.

Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux, up 16 days, 47 min.]

                               GPS & Cameras

Site Timeline