Installing PHPMailer


Having trouble with installation of PHPMailer and hoping to get some insights.

I loaded the package and ran PHPMailerAutoLoad.php. I get no errors or confirmations, just a blank page. Other php documents run from the same directory, so I can only assume it’s running. On the server though, I can find no sign of anything having been installed.

So I’m resorting to manual installation which apparently involves nothing more than placing the key files in the desired directory. I’d like to make that the default include-path but can’t determine what that is.

phpinfo() shows include-path as “.:”. Does that mean it’s set for a root level or is it empty? If it’s a root level, how can I determine what it’s relative to?

Would I possibly disrupt something else if I set a new include-path? (since I don’t know if anything is already loading from it)

Finally, perhaps the dumb part of my question, can I load PHPMailer there as a folder or do I need to drop the parts into the root level of the include-path directory?

[size=8pt][size=10pt]FWIW, I’ve been successfully sending mail w and w/o attachments from the server with PHP for some time. Now I need to authenticate and send via an SMTP server. Rather than switch to a Python process I’ve used, I’m hoping to get PHPMailer in place and working so I can stay with PHP across multipe sites. I’ve chosen it over PEAR as my better hope.[/size][/size]


You don’t need to install it, just add the files, include the phpmailer autoloader and you’re good to go.


Thanks, and by install I understand it’s a matter of adding the files. But that’s largely my question. Where do I add them?

So far I’m unable to discover where the include_path will find them.


Easiest way out is just to add them to the project dir.


Hmm, not sure what the “project directory” is so forgive me if I’m being ignorant. I don’t want to add them to the root folder of each site on the server, if that’s what you mean. A single copy of PHPMailer should be available to all sites for calls all day long from a cgi app. Ideally it would load once on startup, thus my desire to use include_path.


Ah, yeah what I proposed would mean a folder with phpmailer in every project directory. You could just use symlinks though to not have to duplicate files.

You can also add your own custom include paths, either via config or
[php]ini_set(‘include_path’, ‘/usr/lib/pear’);[/php]

Please note that phpmailer isn’t an application/deamon that starts once and runs in the background. It will be “started up” every time you use the script.


Thanks I’ve got it working.

You gave me two key clues: include the phpmailer autoloader and that it will be “started up” every time you use the script.

Instructions I found elsewhere claimed otherwise on both counts.


Glad you got it working :slight_smile: