PhpMailer problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
mhouldridge
Forum Contributor
Posts: 267
Joined: Wed Jan 26, 2005 5:13 am

PhpMailer problem

Post by mhouldridge »

Hi,

I have extracted phpmailer to e:/grd/lib/phpmailer and have also used the FreakMailer class to input the main functions to save time.

My mailtest.php script works however I get the following errors relating to undefined index;


Notice: Undefined index: DOCUMENT_ROOT in E:\GRD\mailtest.php on line 2

Notice: Undefined index: DOCUMENT_ROOT in E:\GRD\mailtest.php on line 4

Notice: Undefined index: DOCUMENT_ROOT in E:\GRD\mailtest.php on line 7

Notice: Undefined index: DOCUMENT_ROOT in e:\grd\lib\MailClass.inc on line 2
Mail sent!


AS far as I can see, the paths to the files are correct, and look as follows;

require_once($_SERVER['DOCUMENT_ROOT'].'e:/grd/config.php')

Does naybody know why this is happening?

thanks
Roja
Tutorials Group
Posts: 2692
Joined: Sun Jan 04, 2004 10:30 pm

Post by Roja »

Your apache isn't setting the document_root. Some versions don't.
User avatar
mhouldridge
Forum Contributor
Posts: 267
Joined: Wed Jan 26, 2005 5:13 am

Post by mhouldridge »

Hi,

I am using IIS.
Roja
Tutorials Group
Posts: 2692
Joined: Sun Jan 04, 2004 10:30 pm

Post by Roja »

mhouldridge wrote:Hi,

I am using IIS.
Okay, so IIS isn't setting the document_root. Use a different variable instead.
User avatar
hanji
Forum Commoner
Posts: 46
Joined: Fri Apr 29, 2005 3:23 pm

Post by hanji »

Code: Select all

require_once($_SERVER['DOCUMENT_ROOT'].'e:/grd/config.php')

I would just remove the whole $_SERVER["DOCUMENT_ROOT"] piece out.. since you're specifying the whole path including drive after it. That's why the script still works.. and you're just getting NOTICE alerts.

hanji
Post Reply