0

This is my code:

$to = 'info@example.de';
$subject = 'Test Subject';
$data = "". echo (rand(12448, 13451)); ."";

$headers = "From: " . strip_tags($_POST['req-email']) . "\r\n";
$headers .= "Reply-To: ". strip_tags($_POST['req-email']) . "\r\n";
$headers .= "Content-Type: text/html;";

$message = '<html>';
$message .= '<td style="color:#ffffff;font-family:Arial,sans-serif;font-size:28px;line-height:36px;text-align:left">'. $data .'</td>';
$message .= '<&/html>';


if(mail($to, $subject, $message, $headers)){
    echo 'Your mail has been sent successfully.';
} else {
    echo 'Unable to send email. Please try again.';
}

I don't get the $data to display right in the HTML E-Mail output.

I need help guys and would be thankful if you help me out here to display the php string in the HTML E-Mail.

Barry
  • 3,303
  • 7
  • 23
  • 42
KKMS
  • 13
  • 4

2 Answers2

2

The line $data = "". echo (rand(12448, 13451)); .""; shouldn't be written like that. I'm surprised it doesn't throw any errors for you. If you simply change it to:

$data = rand(12448, 13451));

it should work just fine.

Dirk Scholten
  • 1,013
  • 10
  • 19
1

You should change this line:

$data = rand(12448, 13451);
Mark Smith
  • 138
  • 1
  • 8