I'm trying to add the feature to send "receipts" after buying and selling stocks. It seems to be very straightforward, I'm just using the code that David used in froshims, but I get the following error:
The following From address failed: firstname.lastname@example.org : Called Mail() without being connected
It seems that it is not connecting. Does this have to do with me not modifying the host?
// send user confirmation via email require_once("PHPMailer/class.phpmailer.php"); // instantiate mailer $mail = new PHPMailer(); // use your ISP's SMTP server (e.g., smtp.fas.harvard.edu if on campus or smtp.comcast.net if off campus and your ISP is Comcast) $mail->IsSMTP(); $mail->Host = "smtp.fas.harvard.edu"; // set From: $mail->SetFrom("email@example.com"); // set To: $mail->AddAddress($email); // set Subject: $mail->Subject = "C$50 Finance: Stocks"; // set body $mail->Body = "Hello" . $username . ", you just bought" . $shares . "of" . $stock["name"] . "at" . $stock["price"] . "per share."; // send mail if ($mail->Send() === false) die($mail->ErrorInfo . "\n");