I'm having a rather same scenerio here for weeks without getting a feasible solution, can any1 help me with this?? As i'm totally new to PHP, i tried many methods found online but got stuck at some stage e.g changing php.ini, using swiftmailer etc. So can any1 guide me along, assuming i jux installed my php and did nth to it...really apreciate it
You see, i'm currently working on a web application which involve sending emails to user. I'm using windowXP SP2, with apache installed incorporate with MySQL as my server. Rite now my code for sending the mail is :
<?php
require_once "Mail.php";
$from = "Sandra Sender <sender@example.com>";
$to = "Ramona Recipient <recipient@example.com>";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";
$host = "smtp.yahoo.com";
$username = "smtp_username";
$password = "smtp_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("<p>" . $mail->getMessage() . "</p>");
} else {
echo("<p>Message successfully sent!</p>");
}
?>
As you can see, i'm trying to use yahoo as my external smtp mail server to help send my mail to my application end user.
Any guidance plss??? tnx alot