Women in Technology

Hear us Roar



Article:
  Configuring sendmail on Jaguar
Subject:   Successfully sending email via SMTP using PHP on OS X
Date:   2002-11-26 14:50:46
From:   anonymous2
Numerous people on this and other discussion boards, including the author of this post, have struggled with a simple objective: How to set up OS X 10.2 (Jaguar)'s Apache/PHP environment to process scripts which send email out over the internet?


The PHP Mail function fails for numerous people who:
[1] Are not running OS X on a qualified domain name (but rather just dialing up to an ISP and accepting a DHCP IP address)
[2] Do not wish to configure SendMail, but prefer to simply use the SMTP server of their ISP


* I don't know why the PHP Mail function is failing for OS X users, but nobody else has posted an answer to my knowledge ;-). Adding a valid php.ini file is insufficient. And configuring SendMail to work for this seems like severe overkill.


HERE'S A WORKING SOLUTION:


The following site contains a php class and sample email test script which enable you to communicate directly with your ISP's SMTP server:


http://www.phpguru.org/smtp.html


1. download it and place both files in your web server document directory, at the same level. You may place both files in a subdirectory of the web server document directory if you wish (e.g. http://localhost/~username/php_email_test/)


2. Edit the example test php script to use SMTP parameter values valid for your ISP account, and format a test message to a valid email address.


3. Execute the sample php script (which uses the PHP 'include' function to access the SMTP class script sitting in the same directory.


With good fortune, you will find this works. Good luck.