Connecting Tech Pros Worldwide Forums | Help | Site Map

PHP email function

roger.rigsby@gmail.com
Guest
 
Posts: n/a
#1: Jun 28 '06
I have a working email functionality on my site but there's a problem
with links. I really want to use the "send this article by email" sort
of functionality on my site. But instead of emailing the entire
article I just want the email to include a link to the article and
ofcourse with query strings and all that sort of stuff the link could
be quite long. In an attempt to make the links look good and mask all
of the details I include the link in an html tag, so a very simple < a
href = " wwwwww.whatevert....com " > Click here < /a >

The problem is that it doesn't work the HTML code doesn't work in
emails. What's the solution. I even tried typing out an html coded
email using my email client and that didn't work so I guess there's
just an issue with email and html.

Anybody know a solution to sending a link via email (using PHP) and
using HTML or whatever so that the entire link isn't visible just the
CLICK here part?


Thanks

r


John Dunlop
Guest
 
Posts: n/a
#2: Jun 28 '06

re: PHP email function


roger.rigsby@gmail.com:
[color=blue]
> I have a working email functionality on my site but there's a problem
> with links. I really want to use the "send this article by email" sort
> of functionality on my site. But instead of emailing the entire
> article I just want the email to include a link to the article and
> ofcourse with query strings and all that sort of stuff the link could
> be quite long. In an attempt to make the links look good and mask all
> of the details I include the link in an html tag, so a very simple < a
> href = " wwwwww.whatevert....com " > Click here < /a >
>
> The problem is that it doesn't work the HTML code doesn't work in
> emails. What's the solution. I even tried typing out an html coded
> email using my email client and that didn't work so I guess there's
> just an issue with email and html.[/color]

I would agree that there is an issue with HTML in e-mails. There is
a body of opinion that says that e-mail and HTML don't click. They
don't get on. Assuming you have considered this...

Couple of questions. Is the Content-Type of the body part set to
text/html? That is, have you told the mail client what format the
message is in? Does the user-agent support, and is it configured to
interpret HTML mail?

One of the design principles of URLs is that they have fewer than ~70
characters, so that they fit on a single line in, for example, e-mails.
Are you perhaps addressing the symptom rather than the cause?

--
Jock

roger.rigsby@gmail.com
Guest
 
Posts: n/a
#3: Jun 28 '06

re: PHP email function


^you are on to something.

I think the content-type is the culprit, but i'm at a lose as to how to
incorporate the content-type into the mail function.

here's my code
mail($EmailTo, $Subject, $Body, "From: '$SName' <$EmailFrom>");

where would conent type go? as one of the headers or within the body?

Krustov
Guest
 
Posts: n/a
#4: Jun 28 '06

re: PHP email function


<comp.lang.php>
<>
<28 Jun 2006 07:36:58 -0700>
<1151505418.665402.149790@b68g2000cwa.googlegroups .com>
[color=blue]
> I have a working email functionality on my site but there's a problem
> with links. I really want to use the "send this article by email" sort
> of functionality on my site. But instead of emailing the entire
> article I just want the email to include a link to the article and
> ofcourse with query strings and all that sort of stuff the link could
> be quite long. In an attempt to make the links look good and mask all
> of the details I include the link in an html tag, so a very simple < a
> href = " wwwwww.whatevert....com " > Click here < /a >
>[/color]

Have you asked people if they want a html (Click here) link instead of a
plain text link ? .


--
www.emailuser.co.uk/?name=KRUSTOV
rojelio@gmail.com
Guest
 
Posts: n/a
#5: Jun 28 '06

re: PHP email function


^
they definitely want a clickable link instead of the full url path.
but in the end if I can't get this clickable link to work i'll just
have to do it as text. Although that even rises a problem. When the
email displays the a href html tag it reads part of the url and makes
it a hyper link.... but the url has spaces in it....(I know not my
doing but there are spaces) there fore it makes the conjoined part of
the url a link and leaves everything after the space regular text and
that looks worse than if it were all just regular text.

Deano
Guest
 
Posts: n/a
#6: Jun 28 '06

re: PHP email function



rojelio@gmail.com wrote:[color=blue]
> ^
> they definitely want a clickable link instead of the full url path.
> but in the end if I can't get this clickable link to work i'll just
> have to do it as text. Although that even rises a problem. When the
> email displays the a href html tag it reads part of the url and makes
> it a hyper link.... but the url has spaces in it....(I know not my
> doing but there are spaces) there fore it makes the conjoined part of
> the url a link and leaves everything after the space regular text and
> that looks worse than if it were all just regular text.[/color]

Try using the php mail class, it has options for specifing html and an
alternate for non html recipients (can't remeber how this works
multipart/alternative header to the message I think??) it also has a
load of other useful bits and pieces in it which makes it a little more
secure and basically more useful than using php's mail() alone

You can find it here: http://phpmailer.sourceforge.net/

Deano

John Dunlop
Guest
 
Posts: n/a
#7: Jun 29 '06

re: PHP email function


Deano:
[color=blue]
> Try using the php mail class, it has options for specifing html and an
> alternate for non html recipients[/color]

Not convinced this is useful, in general. I think it would be better
to find out what format the person prefers to receive e-mails in and
send their e-mails in that format only. For example, you could default
to text/plain and have an opt-in option for text/html.

--
Jock

John Dunlop
Guest
 
Posts: n/a
#8: Jun 29 '06

re: PHP email function


roger.rigsby@gmail.com:
[color=blue]
> I think the content-type is the culprit, but i'm at a lose as to how to
> incorporate the content-type into the mail function.[/color]

As an additional header.

http://www.php.net/manual/en/function.mail.php

--
Jock

roger.rigsby@gmail.com
Guest
 
Posts: n/a
#9: Jun 29 '06

re: PHP email function


^thnx, i'll try this out

the php mail class seems a bit too complicated and long for the simple
function I want

gratzi

roger.rigsby@gmail.com
Guest
 
Posts: n/a
#10: Jun 29 '06

re: PHP email function


it worked thanks Jock

woohoo

Closed Thread


Similar PHP bytes