David
David

Reputation: 16716

email adding spaces in url

I am sending an email with an activation link in it. However, in some cases it looks like the mail client is sending it with a space in the middle which is thus making the link not work.

Any ideas? I think it might be related to the length of the url.

Upvotes: 0

Views: 187

Answers (3)

symcbean
symcbean

Reputation: 48357

I am sending an email with an activation link in it

That implies that you sending the message as HTML (it would have been helpful if you'd provided a minimal example).

And if you're sending HTML, then you MUST be sending it as a MIME attachment (even if the content disposition is inline).

And that implies that you MUST be specifying and applying an encoding method.

While there are a lot of MUAs which don't stick to the rules and will try to render the body of an email as HTML even when it breaks the rules you should write your code so it works as corectly as possible.

There is a limit on the length of a line sent via SMTP. Most likely you are using a representation for your data which does not map correctly to 7-bit ascii with this line length.

If you try using a quoted-printable or base64 encoding, the url should not be modified. In general it's much nicer to use the former.

A good mail library should handle all this for you.

Upvotes: 2

Dan Grossman
Dan Grossman

Reputation: 52372

I propose you send a shorter URL. Have it redirect to the full URL if need be.

Upvotes: 2

Aziz Shaikh
Aziz Shaikh

Reputation: 16524

Might be related to URL encoding/decoding.

Upvotes: 0

Related Questions