How can you format text as bold in the body of an email sent using PHP?
To format text as bold in the body of an email sent using PHP, you can use HTML tags within the email content. Simply wrap the text you want to make bold with <b> and </b> tags. This will apply the bold formatting to the specified text when the email is rendered by the recipient's email client.
<?php
$to = 'recipient@example.com';
$subject = 'Example Email with Bold Text';
$message = '<html><body><p>This is an <b>example</b> email with bold text.</p></body></html>';
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: sender@example.com' . "\r\n";
mail($to, $subject, $message, $headers);
?>
Keywords
Related Questions
- What is the correct way to handle multiple file uploads in PHP using the $_FILES array?
- What are some alternative approaches to managing banner click data and reload restrictions in a PHP application without relying heavily on arrays?
- How can the return statement be used effectively in PHP functions to ensure proper variable access?