ccampbell / sonic

fast, lightweight PHP 5.3 MVC framework
http://www.sonicframework.com
Apache License 2.0
63 stars 11 forks source link

Loading in PEAR's MAIL class within Sonic #23

Closed gordyr closed 12 years ago

gordyr commented 12 years ago

I am trying to use the pear mail package within my Sonic application.

Essentially what I need to do is the following:-

include('/usr/local/lib/php/Mail.php');

$smtp = Mail::factory('smtp', array ('host' => $host, 'auth' => true, 'username' => $username, 'password' => $password)); $mail = $smtp->send($to, $headers, $body);

How would I go about doing this from within a Sonic Controller?

Thanks

ccampbell commented 12 years ago

Hey you should be able to just include the file and use it. You just have to make sure that you are using Mail in the right scope. So for example instead of Mail::factory you should call \Mail::factory.

Alternatively you may be able to add use \Mail as Mail; to the top of the file.

gordyr commented 12 years ago

Great thanks Colin,

I should get a chance to play in about an hour or two and i'll close the issue once solved.

On an unrelated note I have made several improvements to the turbo.js file which most importantly for me ensures that the css is loaded and parsed prior to the fragment being shown. i'll add a pull request when I get home.

ccampbell commented 12 years ago

Cool thanks! My name is Craig by the way :)

gordyr commented 12 years ago

Woops! Sorry I knew that... My father is Colin... I was on the phone to him while typing my reply lol. My apologies! :-P

gordyr commented 12 years ago

Sorry, been so busy this week I didn't get back to you... I now have PEAR mail working absolutely fine thanks. As soon as I get a chance I will make that pull request. Crazy week! :-)