Using & for URL parameter?

Swift Mailer is a fantastic library for sending email with php. Discuss this library or ask any questions about it here.

Moderators: Chris Corbyn, General Moderators

Post Reply
User avatar
seodevhead
Forum Regular
Posts: 705
Joined: Sat Oct 08, 2005 8:18 pm
Location: Windermere, FL

Using & for URL parameter?

Post by seodevhead »

Hey guys,

First off... love SwiftMailer.

Gotta question about how to craft my plain text and HTML messages.

The email that I am sending will include a URL link like the following:

http://www.mysite.com/page.php?x=12&y=34

When I craft my plain text and html message to put into the SwiftMailer $message->attach(new Swift_Message_Part($plainTextVersion)) and .. {repeat}.. ift_Message_Part($htmlVersion))...

..do I need to write the ampersand in the URL as '&', or do I write it as '&'? I don't know whether I need to use the HTML equivalent or not. I am having problems with my emails getting sent to junk folders and didn't know if this could be a culprit.

IE: Which one?

1) $plainTextVersion = 'Blah Blah Blah\n\nhttp://www.mysite.com/page.php?x=12&y=34';
- or -
2) $plainTextVersion = 'Blah Blah Blah\n\nhttp://www.mysite.com/page.php?x=12&y=34';

Thanks for any help!
User avatar
andyhoneycutt
Forum Contributor
Posts: 468
Joined: Wed Aug 27, 2008 10:02 am
Location: Idaho Falls

Re: Using & for URL parameter?

Post by andyhoneycutt »

I've had success with both, but results may vary depending on the end-user's browser.

-Andy
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: Using & for URL parameter?

Post by califdon »

& is a special HTML character, for use in HTML documents to be rendered on the browser screen. URLs are entirely different, not part of HTML standards.
Post Reply