?
Solved

Creating a link in non-html mail

Posted on 2003-02-19
10
Medium Priority
?
261 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
WordPress Tutorial 3: Plugins, Themes, and Widgets

The three most common changes you will make to your website involve the look (themes), the functionality (plugins), and modular elements (widgets).

In this article we will briefly define each again, and give you directions on how to install them.

 
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

762 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