Send Email from PHP Script
Hello
I am trying to send Email from mochahost server. Their technical representative gave me following link to send mail from mochahost.
/http://www.mochasupport.com/kayako/index.php?_m=knowledgebase&_a=viewarticle&kbarticleid=555
I have written the following code, but its neither generating any email, nor giving any error message.
Kindly check the following code and guide me what i am doing wrong here.
Please also guide me that from where to get Mail.php file
[PHP]
";
$to = "Taha ";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
$host = "111.11.11.127";
$username = "username@Hotmail.com";
$password = "password";
$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject);
$smtp = Mail::factory('smtp',
array ('host' => $host,
'auth' => true,
'username' => $username,
'password' => $password));
$mail = $smtp->send($to, $headers, $body);
if (PEAR::isError($mail)) {
echo("
" . $mail->getMessage() . "
"); } else { echo("Message successfully sent!
"); } ?> [/PHP]-
Hey, >> Make sure the PEAR Mail package is installed Did you get a change to verify this ^ ? 0 -
Hello :) I suggest consulting with your web hosting provider for assistance with your script if you do not have root access to your server. You won't be able to review Exim logs with just cPanel access. Thank you. 0 -
Thanks everyone for the reply... I have successfully installed the PEAR Mail Package. It has installed it in home/username/Php/Mail ...Now i am unable to understand that how to link this folder from my code... When i am using the following code its giving me the error message that its unable to find out the "Mail.php" file. [PHP] //require "../../php/Mail.php"; //include 'home/username/php/Mail.php'; [/PHP] The both code written above is unable to find out the Mail.php file. Kindly guide me how to include "Mail.php" file. 0 -
You may find more feedback on a forum dedicated to discussions of PHP programming or from your web hosting provider who can review the script and verify if it should work on their server. Thank you. 0
Please sign in to leave a comment.
Comments
4 comments