<?php
require_once 'lib/swift_required.php';
$transport = Swift_MailTransport::newInstance();
$mailer = Swift_Mailer::newInstance($transport);
$headers = "From: Sebastian@Thorn.se" . "\r\n";
$conn = new mysqli('localhost', 'root', 'rushndie', 'bookmarks');
$username = $_POST['username']
$result2 = $conn->query("select * from user
where username='".$username."'
and passwd = sha1('".$password."')");
$row = $result->fetch_object();
$email = $row->email;
$message = Swift_Message::newInstance()
->setFrom(array('sebastian@thorn.se' => 'SEBASTIAN JOHANSSON THORN'))
->setSubject('Password')
->setTo(array('$email'))
->setBody('"Ditt lösenord är: ".$password."\r\n"
."Tips: Ändra ditt lösenord när du loggat in.\r\n";');
$result = $mailer->send($message);
print_r($result);
?>
Where have I done this wrong?
I want to collect the password from the database
and then send it to the user.