Does anyone know how to put a space for the subject line in between echo-ing a variable and the string itself using the php mail()? I have tried this
$subject = $user_data->first .' '.'recommends a place';
and this
$subject = $user_data->first .' recommends a place';
But when the mail is send, it displays ‘Kevinrecommends a place’.
Here’s the full mail code:
$to = $form_input['email'];
$subject = $user_data->first .' recommends a place on';
$msg =
'Hi,'."\r\n".
"\r\n".
'You were recommended a place by '.$user_data->first .'.'."\r\n".
"\r\n".
'Click the link to see it on **!'."\r\n".
'www.**.com/'.$token."\r\n".
"\r\n".
'Cheers,'
$from = 'From:noreply@**.com';
mail($to, $subject, $msg, $from);
This should work:
Note the double quotes around the text. They are necessary to be sure
$user_data->firstgets interpreted.