firstly i need to search the email from the user and im using that code:
***** PLEASE USE THE
Code: Select all
TAG WHEN POSTING *****[/color]Code: Select all
<?php
ob_start();
mysql_select_db($database_ligacaodados, $ligacaodados);
$sql_util = "SELECT email FROM Utilizador WHERE user='".$_SESSION['MM_Username']."'";
$exe_util = mysql_query($sql_util);
$count=mysql_num_rows($exe_util);
if($count==1){
$rows=mysql_fetch_array($exe_util);
// keep password in $your_password
$email=$rows['email'];
}
?>Code: Select all
<h2>O email foi enviado!
<?php
// ---------------- SEND MAIL FORM ----------------
// send e-mail to ...
$to=$email;
// Your subject
$subject="Confirmação de Compra ";
// From
$header="from: me <myemail@gmail.com>";
// Your message
$messages= "bla\r\n";
$messages.="\r\n";
// send email
$sentmail = mail($to,$subject,$messages,$header);
?>
</h2> thanks