Warning: A non-numeric value encountered in /homepages/10/d677520614/htdocs/ryanragle.com/wp-content/themes/Divi/functions.php on line 5560

MailIcon.jpgStrangely enough, right before I was going to write about this. My MySQL server wanted to play games with me. Anyway, now that my user issue is out of the way. I’m sure if you got here you probably search on sending mail/php/OS X leopard.

So there are a couple of links out there that give you hints, but not all the steps together. So to help out a lost sole, I thought I’d put them all here to view.

I’ll assume that PHP is up and running, you’ve used a terminal, and you have a administrator password…

Step 1: Install Pear Enter a terminal:

curl http://pear.php.net/go-pear > go-pear.php
sudo php -q go-pear.php

when it asks for a directory, I recommend /usr/local

during the installation, it should modify (and ask you about) your php.ini file to include PEAR

Step 2: Install the Mail Class Libraries
Enter a terminal:
sudo pear install Mail
sudo pear install Net_SMTP

Step 3: Create a .php page on your site with the following example and change out bolded text

require_once “Mail.php”;
$from = ”Sandra Sender <sender@example.com>”;
$to = ”Ramona Recipient <recipient@example.com>”;
$subject = “Hi!”;
$body = “Hi,nnHow are you?”;
$host = ”mail.example.com”;
$username = ”smtp_username”;
$password = ”smtp_password”;
$headers = array (’From’ => $from,’To’ => $to,’Subject’ => $subject);
$smtp = Mail::factory(’smtp’,array (’host’ => $host,’auth’ => true,’username’ => $username,’password’ => $password));
$mail = $smtp->send($to, $headers, $body);

You should be rockin and rollin