How to add css in message body sending mail

To add CSS to the body of an email message, you can use HTML and CSS together. Here are a few ways to do it:

Method 1: Using HTML and CSS inline

You can add CSS styles directly to the HTML elements in the email body using the style attribute. For example:

<p style="font-size: 16px; color: #333;">This is a paragraph of text.</p>

Method 2: Using an external CSS file

You can link an external CSS file to your email using the <link> tag. For example:

<head>
  <link rel="stylesheet" type="text/css" href="styles.css">
</head>

Then, in your styles.css file, you can define your CSS styles:

body {
  font-family: Arial, sans-serif;
  font-size: 16px;
  color: #333;
}

p {
  margin-bottom: 10px;
}

Method 3: Using a CSS block in the email body

You can add a CSS block directly to the email body using the <style> tag. For example:

<style>
  body {
    font-family: Arial, sans-serif;
    font-size: 16px;
    color: #333;
  }

  p {
    margin-bottom: 10px;
  }
</style>

<p>This is a paragraph of text.</p>

Important notes:

Here's an example of how you might use CSS in an email message:

<html>
  <head>
    <meta charset="UTF-8">
    <title>Email Example</title>
    <style>
      body {
        font-family: Arial, sans-serif;
        font-size: 16px;
        color: #333;
      }

      p {
        margin-bottom: 10px;
      }
    </style>
  </head>
  <body>
    <h1>Welcome to our email example!</h1>
    <p>This is a paragraph of text.</p>
    <p>This is another paragraph of text.</p>
  </body>
</html>