The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End PHP mailer issue/file path issue Reply To: PHP mailer issue/file path issue


If you’re trying to require this:


from here:

/Applications/MAMP/htdocs/For The Bold v2/contact.php

Then the file path you are actually requesting is this:

/Applications/MAMP/htdocs/For The Bold v2/inc/phpmailer/class.phpmailer.php

Is this what you expected? is this where the file actually is?

I would suggest always using absolute paths when loading files. This way, there is never any question about whether or not you have the path correct. The easiest way to do this is to use $_SERVER['DOCUMENT_ROOT']:

require_once "{$_SERVER['DOCUMENT_ROOT']}/inc/phpmailer/class.phpmailer.php";
// or wherever your file is
// (this example assumes that your document root is /Applications/MAMP/htdocs )

(As a side note, I would strongly advise against using spaces in file names/ paths.)