Dynamically created anchor tags are not displaying as a link in email template when received at client end

  email, hyperlink, phpmailer, symfony, templates

I am creating a link for an email template to approve some order.

$approvalLink = "<a href='" . $url . "/Request/Approval/code/" . $Code . "'>Approve</a>";

This link works fine most of the time but sometimes it displays as a string because an unintended space is added between “<” and “a”. As a result of this link appears to be a string. this is how link looks like in the email:

< a href='blahblah'>Approve</a>

What can be the possible reason for this space and how can I fix it?

I am using PHP, symfony and phpmailer class to send emails.

Source: Symfony Questions

LEAVE A COMMENT