Mail.php- problem in sending mail

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
jasvarghese
Forum Newbie
Posts: 3
Joined: Fri Aug 24, 2007 2:30 am

Mail.php- problem in sending mail

Post by jasvarghese »

Hai All,

i am a newbie to php. I created code to send mail and when i am trying to send it its throwing an error like

Warning: require_once(Mail.php) [function.require-once]: failed to open stream: No such file or directory in D:\hosting\member\xentaqsys\testsite\sampleTwo\user\index.php on line 35

Fatal error: require_once() [function.require]: Failed opening required 'Mail.php' (include_path='.;C:\php5\pear') in D:\hosting\member\xentaqsys\testsite\sampleTwo\user\index.php on line 35

Why its happening?
The site is hosted in an IIS server. If anyone know the solution [s]pls[/s] please let me know as early as possible. I am in a hurry to get the solution for the same. how cold i rectify this. All the helps would be greatly appreciated.

Thanks & regards
jaison
[url=http://forums.devnetwork.net/viewtopic.php?t=30037]Forum Rules[/url] Section 1.1 wrote:11. Please use proper, complete spelling when posting in the forums. AOL Speak, leet speak and other abbreviated wording can confuse those that are trying to help you (or those that you are trying to help). Please keep in mind that there are many people from many countries that use our forums to read, post and learn. They do not always speak English as well as some of us, nor do they know these aberrant abbreviations. Therefore, use as few abbreviations as possible, especially when using such simple words.

Some examples of what not to do are ne1, any1 (anyone); u (you); ur (your or you're); 2 (to too); prolly (probably); afaik (as far as I know); etc.
User avatar
xpgeek
Forum Contributor
Posts: 146
Joined: Mon May 22, 2006 1:45 am
Location: Kyiv, Ukraine
Contact:

Post by xpgeek »

What library do You use to send mail?

Check path to you library.

Why you don't use http://php.net/mail function ?
jasvarghese
Forum Newbie
Posts: 3
Joined: Fri Aug 24, 2007 2:30 am

Post by jasvarghese »

feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Here i'm placing the code...

Code: Select all

require_once "Mail.php";

$recipients = "jasvarghese@gmail.com";
$headers["From"] = "mail@mySite.com";
$headers["To"] = "contact@mySite.com";
$headers["Subject"] = "User feedback";
$mailmsg = "Hello, This is a test.";
// SMTP server name, port, user/passwd
$smtpinfo["host"] = "hostName";
$smtpinfo["port"] = "25";
$smtpinfo["auth"] = true;
$smtpinfo["username"] = "mail@mySite.com";
$smtpinfo["password"] = "*****";
// Create the mail object using the Mail::factory method
$mail_object =& Mail::factory("smtp", $smtpinfo);
// Ok send mail
$mail_object->mail($recipients, $headers, $mailmsg);


This is an alternate code which i tried

mail('jasvarghese@gmail.com', 'My Subject', $message);

This is also not working...

Is there any problem with the hosting????
if so wat should i do to rectify it???


feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
User avatar
xpgeek
Forum Contributor
Posts: 146
Joined: Mon May 22, 2006 1:45 am
Location: Kyiv, Ukraine
Contact:

Post by xpgeek »

Yes, i think it is hosting problem.

You can try login on ssh and type mail command.
Try send mail to you self to see it working or not.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Hosting problem? Mail.php was not found in the path. Therefore the file could not be loaded. You need to put the file where PHP can find it. It's a pretty straight forward error.
Post Reply