Anchor tag not clickable in outlook

1.2k views Asked by At

So I have a SMTP server to send emails. I want to include some hyperlinks in the email. Right now I am constructing the hyperlinks like this:

<body>
<ul>
  <li><a href="https://google.com">https://google.com</a></li>
</ul>
</body>

However, when I received it from outlook. The link is not displayed as expected and is not clickable. When I do an inspect element, I am getting:

<body>
<ul>
  <li>[/https://google.com]https://google.com</li>
</ul>
</body>

Can someone please suggest what I am doing wrong? Thanks!

2

There are 2 answers

2
Ravi Naithani On

You have to enable HTML for the body of the Mail message.

2
Ravi Naithani On

We will use the message parameter(a big string we pass to the mail function with the body of our email).

$message = '<html><body>';
$message .= '<h1>Hello, World!</h1>';
$message .= '</body></html>';

Now using PHP mail():-

mail($to, $subject, $message, $headers);

Just use this according to your needs.