Page 1 of 1
Noob Q: Installing Swift Mailer
Posted: Tue Feb 20, 2007 1:24 pm
by xpt
Installing Swift Mailer is exremely easy, as with most PHP Libraries.
The problem is I'm new to php and have only install php modules the pear way, seems that you can put the extracted 'lib' directory anywhere. So what is the recommended location that I should put the lib dir, so that php can see it?
Can I install the swiftmailer the pear way? If so, how?
I'm using FC5 currently.
thanks
Posted: Tue Feb 20, 2007 2:28 pm
by dillion
In theory you could put the lib folder anywhere in your web root folder but I usually put them into a "class" or "includes" folder where other classes reside (e.g. functions, validation, connection strings, etc.).
Once you have copied the files to a folder, you then need to load them into a page (aka parent file) that will use the emailer by doing either a require or include:
Code: Select all
require_once "lib/Swift.php";
require_once "lib/Swift/Connection/SMTP.php";
// and any other plugins, etc. that you need
The path specified above assumes that your parent file is in a root folder.
Btw, sorry I am not too familar with PEAR except for Excel exporter facility.
toss it in the PEAR directory
Posted: Sat Mar 03, 2007 2:36 pm
by audrey
The PEAR repository is already in the include path, so you can unpack Swift in there.
On my setup (linux):
# change to wherever your PEAR dir is
cd /usr/local/php/lib/php
# unpack the tarball from wherever you downloaded it to into this dir
tar xzvf ~/downloads/Swift-3.0.1-php5.tar.gz
# create a soft link named "Swift"
ln -s Swift-3.0.1-php5 Swift
Now, in your script:
require_once 'Swift/lib/Swift.php';
etc. The same principles apply for Windows, although i'm not familiar with the specifics of that OS.