View Full Version : Sending an email:

05-03-2009, 07:29 PM
$text = "Hello, $a['name']\n\n";
$text .= "This email contains trusted information.\n";
$text .= "Do not share this email with someone.\n";
$text .= "Your password will be unique,\n";
$text .= "You can change it ingame or throught the website\n";
$text .= "This is your new password:\n";
$text .= "$password";
$text .= "\nRegards,";
$text .= "\n$sitename, $siteowner";
$text .= "\n\n\n";
$text .= "This is an automatic generated email do not answer.";
mail($a['email'], "New password", $text, $header);

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /process.php on line 37

whats wrong? :X

05-03-2009, 07:41 PM
I guess it's the line

$text = "Hello, $a['name']\n\n";
that's producing the error?

Change it to

$text = "Hello, ".$a['name']."\n\n";

$text = "Hello, {$a['name']}\n\n";
and it should work.

05-03-2009, 08:09 PM
Thanks, worked :d but now this :

include 'sitevars.php';

$text .= "\n".$text['sitename']." and ".$text['siteowner'].".";

// sitevars.php :
$text['sitename'] = "Digital-RP";
$text['siteowner'] = "Pandabeer1337";

gives this:

H and H.

Whats wrong now :X

05-03-2009, 08:40 PM
I don't see how it would give "H and H.".

Anyway, since you are using global variables everywhere, you can't use the variable $text for your string, if it's already your array.