?
Solved

Creating a link in non-html mail

Posted on 2003-02-19
10
Medium Priority
?
268 Views
Last Modified: 2011-09-20
Using the build in mail function in PHP, mail(), can I send a text in the body that has a link attached to it (<a href="">...</a>)

I can't do this:

$mail_body = "Some text in the email with <a href=\"link.html\">link</a>"

Is there some other way!
0
Comment
Question by:littleiceland
10 Comments
 
LVL 7

Expert Comment

by:Big_Red_Dog
ID: 7981526
What do you mean you can't do it?  Is it just a simple link or do you want to send full blown HTML mail?

Did your message body look like this:

$msg = "<HTML><HEAD><TITLE>My Message</TITLE></HEAD><BODY>Some text in the email with <a href=\"link.html\">link</a></BODY></HTML>";

If not, do it...

See these publically available PHP classes rather than re-inventing the wheel if you want to do the full blown thing:

http://phpmailer.sourceforge.net/
http://www.phpguru.org/mime.mail.html
0
 
LVL 40

Accepted Solution

by:
Richard Quadling earned 300 total points
ID: 7981562
It really depends on the email reader. I use Outlook (not OE). I can receive a plain text email which contains links, as long as the links look like ...

http://www.site.com

No anchors or HTML.

Richard.
0
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 7981568
Sometimes these come in as ...

This is the link(http://www.site.com).

Richard.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 7

Expert Comment

by:Big_Red_Dog
ID: 7981599
Yes, Richard is correct that mail readers, including Eudora that I use, will render links if they are fully qualified with http:// or mailto: or ftp://, etc.

That is why I asked what you meant by "I can't do this".  Are you getting an error or what?
0
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 7981644
In fact, if I create a new email in Outlook, set it to plain text (not html or rtf), and then start typing ftp:/ http:/ telnet:/ mailto:x gopher:/ these all are now blue and have the "link" underline to them.

Even www.site.com (no http) works!

0
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 7981659
I think the questioner is wondering how to embed a link in plain text.

The answer is that you don't. The email reader will show it correctly (in most cases).

Richard.
0
 
LVL 1

Expert Comment

by:s-maxim
ID: 7988241
This makes no sense - there is no such thing as "link" in a non-html (Content-Type: text/plain;) emails. Normally, users receive the links all day long - they will know how to click if you just send the URL without any tags.

Also good because HTML emails are getting blocked most oif the times as users get annoyed by spammers and install anti-spam systems.

be safe - write URLs without any tags.

Maxim Maletsky
maxim@php.net
0
 
LVL 7

Expert Comment

by:Big_Red_Dog
ID: 7988476
Uh yes and no.  The whole point Richard is making that you don't have to put explicit tags into your mail because *most* popular mail clients detect http://<mumble> and mailto:<foo>@<bar>, etc. and make them hyperlinks when they display them so the reader can click on them.

Because littleiceland said he or she had a problem with adding links, it isn't clear what the problem is and if he or she would let us know, we'd know whcih way to go in helping...
0
 
LVL 7

Expert Comment

by:Big_Red_Dog
ID: 7988481
Drat...  See, even EE detects the tags.  Look at the mess it made of my last post, but this is exactly what Richard was talking about that the mail clients do...
0
 

Expert Comment

by:massDer
ID: 7994718
make the link text the same and the href value ... this will work no matter what.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
The title says it all. Writing any type of PHP Application or API code that provides high throughput, while under a heavy load, seems to be an arcane art form (Black Magic). This article aims to provide some general guidelines for producing this typ…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question