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: [email protected]' . "\r\n" .
    'Reply-To: [email protected]' . "\r\n" .
    'Return-Path: [email protected]' . "\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
https://forums.phpfreaks.com/topic/46207-solved-php-mail-and-sessions-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.