whiteatom
whiteatom

Reputation: 1455

Link in generated email content broken in some clients

I'm generating an HTML email through a PHP script to send out. In the email, there is a link, and the href is set dynamically. If I dump the email content to a text file, I get the correct url, however, when I receive the email in Apple Mail, the link is broken. I've have also tested an email in GMail's web interface and the link is also broken.

Intended link: 
  http://test.domain/wp-admin/admin.php?page=test-plugin&action=edit&entry_id=48
What the client outputs: 
  http://test.domain/wp-admin/admin.php?page=test-plugin&action%EF%BF%BDit&entry_id1

The strangest thing is in Apple Mail, if I view the Raw Source of the message, the link appears as

 http://test.domain/wp-admin/admin.php?page=test-plugin&action=edit&entry_id=48

On Gmail it's a mess...

 http://wordpress.local/wp-admin/admi=
 n.php?page=3Dtest-plugin&action%EF%BF%BDit&entry_idH"

So what is causing the clients to break this URL?

To me, that looks like a base_64 encoding issue ("=ed" and "=48" get converted somehow), but the html content isn't base_64 encoded.

The Content-Types all seem to be set correctly.

In the Email Header:

 Content-Type: multipart/related; boundary="inline717a95a1da99481c8ff625418eeedf70"; charset=UTF-8;

In the email content boundary:

 Content-Type: text/html; charset=UTF-8
 Content-Transfer-Encoding: Quoted-Printable

And in the HTML email :

 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

Link is generated through a PHP statement. I'm running it through "mb_convert_encoding" as part of my troubleshooting>

 mb_convert_encoding(get_site_url().'/wp-admin/admin.php?page=test-plugin&action=edit&entry_id='.$entry->id, "UTF-8");

Do you have any idea where I should look to troubleshoot this?

Upvotes: 0

Views: 30

Answers (0)

Related Questions