Home › Forums › Back End › PHP mailer issue/file path issue › Reply To: PHP mailer issue/file path issue
May 27, 2014 at 10:33 pm
#171217
Participant
If you’re trying to require
this:
inc/phpmailer/class.phpmailer.php
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.)