Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9035579
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T08:47:31+00:00 2026-06-16T08:47:31+00:00

I want an email to be sent in HTML and inside this email i

  • 0

I want an email to be sent in HTML and inside this email i need to pass data from php form. The email is sent successfully as an html email but it doesn’t display data passed from PHP VARIABLE.

$name = "PHP TEXT";
$headers = "From: " ."mail@example.com" . "\r\n";
$headers .= "Reply-To: ". "mail@example.com" . "\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";

$message = "<html><body><h1>HTML TEXT <?php echo $name; ?></h1></body></html>";

$email_to = 'example@mail.com'; //the address to which the email will be sent
$subject = "test";
$email    =   "example@mail.com";

if (mail($email_to, $subject, $message, $headers)) {
    echo 'sent'; // success      
} else {
    echo 'failed'; // failure    
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T08:47:32+00:00Added an answer on June 16, 2026 at 8:47 am

    This line:

    $message = "<html><body><h1>HTML TEXT <?php echo $name; ?></h1></body></html>";
    

    it should be like:

    $message = "<html><body><h1>HTML TEXT $name </h1></body></html>";
    

    or

    $message = "<html><body><h1>HTML TEXT " . $name . " </h1></body></html>";
    

    <?php and ?> is used to specify that text inside it is a PHP code, not HTML. Here are some details about that.

    But you are already in PHP code block and instead of specifying another PHP block, you should use string concatenation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've installed this django-contact-form app. When I want to send an email to my
I have successfully sent email in my web application using JMS, but the result
I have created a html form and it stores the data using php/mysql. Now
What i want to achieve: I have a simple html form and I sent
The following Code doesn't seem to work,I want the email keyboard with @ and
I want to send email through Java (Any email like from yahoo, gmail, or
I want to plot email from and to in world. For example, I received
I want send a email by Email Class in codeigniter with gmail, but i
I am new with cron job in php,basically i want to send email to
In grails, I use a GSP template to render an HTML email sent out

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.