/    Sign up×
Community /Pin to ProfileBookmark

sending smtp mail

Hi,

I am sending a mail through our smtp server using php.
this is wriiten in “test/sendmail.php”.
The code works fine when I use “localhost/testsendmail.php”

I have a page test.php with a button on it.
Now what I want to do is when a button is clicked; using javascript and ajax it will access the sendmail.php file and send the mail and the result “mail sent or error ” will be displayed in the test.php page.

I can access sendmail.php from my test.php page.
but I get the message “require_once(Mail.php) [function.require-once]: failed to open stream: No such file or directory in C:xampphtdocsiMonisendmail.php on line 7 “

looks like it is not accepting the path Mail.php

I can figure out why.
appreciate any help given. thanks and regards,

to post a comment
PHP

5 Comments(s)

Copy linkTweet thisAlerts:
@NogDogJul 13.2011 — Is there, in fact, a "Mail.php" file on that server, either in the same directory as the script doing the require() or in your configured PHP include_path? Does it have read permission for all?
Copy linkTweet thisAlerts:
@shamigauthorJul 15.2011 — Thank you for the reply.

yes there is the file in the server and is in my include_path.

but I figured out what is wrong. I have put a set_include_path(../) at the top of my code.

so when I look for mail.php set include path looks for ../mail.php so it works when I remove that.

But coming to another problem I thought set include path would first check mail.php and if it doesn't exist it goes to ../ mail php.
Copy linkTweet thisAlerts:
@NogDogJul 15.2011 — You probably also want "." in the include_path (for the current directory). In any case, you can add something to the include path without blowing away the existing setting with something like:
[code=php]
$path = ".." . DIRECTORY_SEPARATOR;
set_include_path($path . PATH_SEPARATOR . get_include_path());
[/code]
Copy linkTweet thisAlerts:
@shamigauthorJul 25.2011 — sorry for the late reply. Thank you. Ill try that.
Copy linkTweet thisAlerts:
@shamigauthorJul 27.2011 — Thanks NogDog. the final include path worked beautifully.
×

Success!

Help @shamig spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...