Php html email css template

Here is a basic PHP, HTML, CSS template for an email:

HTML Template

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Email Template</title>
    <style>
        /* Add your CSS styles here */
        body {
            font-family: Arial, sans-serif;
            margin: 0;
            padding: 0;
        }
       .container {
            max-width: 600px;
            margin: 0 auto;
            padding: 20px;
            background-color: #f9f9f9;
            border: 1px solid #ddd;
            border-radius: 10px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
        }
       .header {
            background-color: #333;
            color: #fff;
            padding: 10px;
            text-align: center;
            border-bottom: 1px solid #333;
        }
       .content {
            padding: 20px;
        }
       .footer {
            background-color: #333;
            color: #fff;
            padding: 10px;
            text-align: center;
            border-top: 1px solid #333;
        }
    </style>
</head>
<body>
    <div class="container">
        <div class="header">
            <h2>Email Template</h2>
        </div>
        <div class="content">
            <!-- Add your email content here -->
            <p>Hello, [Name]!</p>
            <p>This is an example email template.</p>
            <p>Best regards,</p>
            <p>[Your Name]</p>
        </div>
        <div class="footer">
            <p>This email was sent by [Your Company Name].</p>
        </div>
    </div>
</body>
</html>

PHP Code

<?php
// Set the email variables
$name = 'John Doe';
$email = '[email protected]';
$subject = 'Email Template Example';

// Set the email content
$content = '<p>Hello, '. $name. '!</p><p>This is an example email template.</p><p>Best regards,</p><p>'. $name. '</p>';

// Set the email headers
$headers = 'MIME-Version: 1.0'. "\r\n";
$headers.= 'Content-type: text/html; charset=UTF-8'. "\r\n";
$headers.= 'From: '. $email. "\r\n";
$headers.= 'Reply-To: '. $email. "\r\n";

// Set the email body
$body = '<html>'. $content. '</html>';

// Send the email
mail('[email protected]', $subject, $body, $headers);
?>

CSS Styles

You can add your CSS styles to the <style> block in the HTML template. For example:

body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
}

.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    background-color: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

.header {
    background-color: #333;
    color: #fff;
    padding: 10px;
    text-align: center;
    border-bottom: 1px solid #333;
}

.content {
    padding: 20px;
}

.footer {
    background-color: #333;
    color: #fff;
    padding: 10px;
    text-align: center;
    border-top: 1px solid #333;
}

This template uses a basic HTML structure with a container div, header, content, and footer sections. The CSS styles add some basic layout and design elements to the template.

You can customize the template by adding your own HTML, CSS, and PHP code. You can also use a PHP email library like PHPMailer to send the email with more advanced features.