Jump to content

Add a Link in a Text Email


doubledee

Recommended Posts

Is there a way to add an HTML link in a Text E-mail that was generated by PHP?

 

I am trying to create an e-mail that looks like this...

 

Dear Member,

 

Your password was re-set, and the following Temporary Password has been assigned:

 

Use this temporary password to Log In.

 

 

Debbie

 

 

 

Link to comment
Share on other sites

<?php
$link="http://mysite.com/link/to/url";
$message= <<<EOD Dear Member,<br />Your password was reset, 
a Temporary Password has been assigned click this link to  <a href="$link">login</a>.
EOD;?>

 

What is <<<EOD ???

 

How well supported is that code?

 

Does it work in all/most e-mail clients that are in Text-Only e-mail mode?

 

 

Debbie

 

 

Link to comment
Share on other sites

The PHP heredoc string syntax allows free form text to be used without having to worry about escaping special characters such as quotes and backslashes. The content of the heredoc string is wrapped with <<<EOD and EOD; markers.

 

The only rules are that the closing EOD; must be at the beginning of the last line.

 

and no it will not show in a text only email the  content type will have to be specified as html.

Link to comment
Share on other sites

The PHP heredoc string syntax allows free form text to be used without having to worry about escaping special characters such as quotes and backslashes. The content of the heredoc string is wrapped with <<<EOD and EOD; markers.

 

The only rules are that the closing EOD; must be at the beginning of the last line.

 

and no it will not show in a text only email the  content type will have to be specified as html.

 

But I asked how to make a link in my e-mail like this:  Log In

 

So Heredoc won't address that issue?

 

Aren't all e-mails "text-only" by default?

 

Like isn't my Gmail e-mail text only?  It looks that way.

 

 

Debbie

 

 

Link to comment
Share on other sites

So how do you properly send an HTML email along with a plain-text alternative version? Simple. You send it in "Multipart/Alternative MIME" format. If you're a programmer, this is where the gears in your brain start spinning. Now, go on and Google "multipart alternative" and figure out how to send them from your own server. You may find some PHP or Coldfusion or ASP scripts out there.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.