User Profile - PHP mail

Post here is you are having problems with any of the tutorials.
Post Reply
User avatar
rabatos
Posts: 46
Joined: Thu Aug 09, 2012 11:06 am

User Profile - PHP mail

Post 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?
User avatar
rabatos
Posts: 46
Joined: Thu Aug 09, 2012 11:06 am

Re: User Profile - PHP mail

Post 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;
?>
User avatar
rabatos
Posts: 46
Joined: Thu Aug 09, 2012 11:06 am

Re: User Profile - PHP mail

Post by rabatos »

SOLVED
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: User Profile - PHP mail

Post by jacek »

rabatos wrote:SOLVED
<3 self solving topics :)
Image
Post Reply