PHP पियर मेल का उपयोग करने के लिए mail.php को कैसे शामिल करें। मैं test.php फ़ाइल में निम्न कोड का उपयोग कर रहा:PHP पीयर मेल का उपयोग कैसे करें
require_once "Mail.php";
$from = "<[email protected]>";
$to = "<[email protected]>";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
$host = "ssl://smtp.gmail.com";
$port = "465";
$username = "<[email protected]>";
$password = "testtest";
$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject);
$smtp = Mail::factory('smtp',
array ('host' => $host,
'port' => $port,
'auth' => true,
'username' => $username,
'password' => $password));
$mail = $smtp->send($to, $headers, $body);
if (PEAR::isError($mail)) {
echo("<p>" . $mail->getMessage() . "</p>");
} else {
echo("<p>Message successfully sent!</p>");
}
और निम्न त्रुटि का सामना करना पड़ा है इस कोड के माध्यम से:
Warning: require_once(Mail.php) [function.require-once]: failed to open stream: No such file or directory in D:\Hosting\6525150\html\test.php on line 3
Fatal error: require_once() [function.require]: Failed opening required 'Mail.php' (include_path='.;C:\php5\pear') in D:\Hosting\6525150\html\test.php on line 3
कोई मुझे बता सकते हैं समस्या क्या है?
नाशपाती मेरे सर्वर पर स्थापित है। और पथ शामिल है "; सी: \ php5 \ नाशपाती" – Deepa
आपको मेल पैकेज को भी स्थापित करने की आवश्यकता है –
phpinfo() का उपयोग करके php include_path भी जांचें; –