Mailing List Archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[tlug] Testing email functions within PHP on my local machine


My home machine is set up as a LAMP server, but just for testing PHP scripts locally. It doesn't serve pages to the internet.

Recently, I've been writing some scripts that have email functionality. However, I can't seem to test them because my PHP environment can't find an SMTP server.

I'm hoping I don't have to install an SMTP server on my local machine, because my understanding of SMTP is that it is very complicated.

Instead, I was hoping I could just specify one of the SMTP servers that are available to me through my various email accounts. I have one with my ISP that I use to send mail from within Thunderbird, and a couple that are on my webhosting service.

I've been trying to figure out how to do this, but I'm going around in circles.

First, I thought I could specify an SMTP host within the mail() function of PHP. But I'm not sure if it's something I can specify within the headers.

Second, I thought I would download the phpmailer classes from SourceForge. Although these classes give me an option to specify an SMTP host, I keep getting the following error:
Mailer error: SMTP Error: Could not connect to SMTP host.

Last, it seemed that maybe what I needed to do was specify an SMTP host to use in my php.ini file. However, the section on SMTP says, right in the file that it applies to "Win32 only":
[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25
; For Win32 only.
;sendmail_from =

There's a "sendmail_path" variable, but wouldn't I have to have a local SMTP installation in order for it to be on my path?

What is the simplest and most reliable way to be able to send email via SMTP with my local LAMP testing environment?

Thanks for any advice.

Dave M G

Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links