Page 1 of 1

User Profile - PHP mail

Posted: Sun Aug 26, 2012 12:52 pm
by rabatos
I have a user profile system for my website and each user has their dedicated profile page.
I added a contact form on the profile page and I wanted website users to be able to fill the form and contact the member of that profile directly from their profile page.

I want to know what function and code I need to get the user's email from the profile page uid, and use it in the mail function.
I've tried what I could with certain functions but I can't seem to get the profile page uid to correspond with the select function.

Any ideas?

Re: User Profile - PHP mail

Posted: Sun Aug 26, 2012 1:28 pm
by rabatos
This is a basic mail function which I tried, obviously the $to is wrong, but I wasn't sure how to do it.
I put in echo $to at the end to test whether the email is being select which it is not.
<?php

include('core/init.inc.php');

$pageTitle = "Contact Us";

$user_info = fetch_user_info($_GET['id']);

include('includes/header.php');

$to = "{$user_info['email']}";
$subject = "Test mail";
$message = "Hello! This is a simple email message.";
$from = "someonelse@example.com";
$headers = "From:" . $from;
mail($to,$subject,$message,$headers);
echo "Mail Sent.";
echo $to;
?>

Re: User Profile - PHP mail

Posted: Sun Aug 26, 2012 11:46 pm
by rabatos
SOLVED

Re: User Profile - PHP mail

Posted: Mon Aug 27, 2012 11:21 pm
by jacek
rabatos wrote:SOLVED
<3 self solving topics :)