Jump to content

[SOLVED] PHP mail and sessions problem


ukferret

Recommended Posts

Firstly here is the code;

<?php 

$username = $_SESSION['username'];
$to      = $_SESSION['email'];
$subject = 'Snooker Profiles Registratin Confirm';
$message = '<b>Welcome to our website</b><br/><br/>Your Username is- $username';
$headers = 'From: mail@domain.com' . "\r\n" .
    'Reply-To: mail@domain.com' . "\r\n" .
    'Return-Path: mail@domain.com' . "\r\n" .
'Content-type: text/html; charset=iso-8859-1' . "\r\n" .
    'MIME-Version: 1.0' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();
$message = wordwrap($message, 70);
mail($to, $subject, $message, $headers);

?>

 

I have several SESSIONS being sent from a previous page and I want to put the info in the SESSION into the body of the email, this line;

$message = '<b>Welcome to our website</b><br/><br/>Your Username is- $username';

is where I am having the problems! the SESSION I have changed into a string and the string prints out as $username instead of the value.  I am sure I need to escape it again but I just can not get my head around it, can anybody help?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.