473,387 Members | 1,548 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

PHP email function

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

Jun 28 '06 #1
9 1372
ro**********@gmail.com:
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.


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

Jun 28 '06 #2
^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?

Jun 28 '06 #3
<comp.lang.php>
<>
<28 Jun 2006 07:36:58 -0700>
<11**********************@b68g2000cwa.googlegroups .com>
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 >


Have you asked people if they want a html (Click here) link instead of a
plain text link ? .
--
www.emailuser.co.uk/?name=KRUSTOV
Jun 28 '06 #4
^
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.

Jun 28 '06 #5

ro*****@gmail.com wrote:
^
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.


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

Jun 28 '06 #6
Deano:
Try using the php mail class, it has options for specifing html and an
alternate for non html recipients


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

Jun 29 '06 #7
ro**********@gmail.com:
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.


As an additional header.

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

--
Jock

Jun 29 '06 #8
^thnx, i'll try this out

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

gratzi

Jun 29 '06 #9
it worked thanks Jock

woohoo

Jun 29 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Saintor | last post by:
I have a string of email addresses with duplicates. like "abc@abc.com; cde@cde.com; abc@abc.com" If I use this string with sendobject, the receiver will get it only once which is perfect to...
5
by: paii, Ron | last post by:
How do I setup a email with attachment for preview but require the user to push the SEND button in Outlook. I have the following function but it sends the email without the sender ever seeing it. ...
36
by: Liam.M | last post by:
hey guys, I have one last problem to fix, and then my database is essentially done...I would therefore very much appreciate any assistance anyone would be able to provide me with. Currently I...
26
by: libsfan01 | last post by:
Hi all! Can anyone show me how to check and email field on a form for the existence of these two characters. Kind regards Marc
4
by: roohbir | last post by:
Hello, I need help with the following code. Would be very grateful for comments. I have a function called emailValid, and it is supposed to alert the user if h/she leaves the field blank. I want...
16
by: matt | last post by:
I have used some free code for listing files for download, but I want to send an email to the administrator when the file has been downloaded. I have got some code in here that does it, but it will...
2
by: comp.lang.php | last post by:
I came up with functions that I thought would do the trick: if (!function_exists('smtp_close')) { /** * This function will close a socket resource handle * * Original function found at...
1
by: sxwend | last post by:
I am trying to use the following post results (http://www.thescripts.com/forum/thread189759.html) and add another requirement. I need to send the results to just the email addresses that the query...
5
by: muppetjones | last post by:
I'm really new to the whole networking side of things, so I don't know the backend very well. I wrote a series of PHP/AJAX scripts to allow a user to create a login account, but apparently my script...
27
matheussousuke
by: matheussousuke | last post by:
I'm having trouble with e-mail sending, I mean, the website is suposed to send a confirmation email after sign up, but it gets like text plain instead of HTML May someone help me, please? ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.