How to send Email from mochahost SMTP server
Hello
I am trying to send email from mochahost server. This is the link that mocha host technical adviser provided me.
[url=http://www.mochasupport.com/kayako/index.php?_m=knowledgebase&_a=viewarticle&kbarticleid=555]PHP SMTP Authentication
I am following this but its not sending any email. Kindly guide me what i am doing wrong here.
First kindly tell me what does "Mail.php" contains? and guide me what i am doing wrong in this code.
The program is neither generating any error message nor printing any output.
[PHP]
";
$to = "Taha ";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
$host = "111.11.11.127";
$username = "tahakirmani@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]Please sign in to leave a comment.
Comments
0 comments