Solved

phpmailer sending email as hyperlinked

Posted on 2013-02-04
2
254 Views
Last Modified: 2013-02-05
I am using phpmailer to generate emails.  In the body of the email I want to include a link to our site, but I do not want the actual url to be displayed - just a "click here" .  My code is like this:

      $mail->Subject =  ' Can You View?';

      $message = '<html><body><p><a href="http://www.amazon.com" >Click Here</a> to go shopping!</p></body></html>';
      
      $mail->MsgHTML($message);

But the email displays:
Click Here <http://www.amazon.com>  to go shopping!

The link works - I just don't want to display the url.
0
Comment
Question by:PegOC96
[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
2 Comments
 
LVL 6

Accepted Solution

by:
nickinthooz earned 500 total points
ID: 38853412
try this...see if it changes anything

$mail->IsHTML(true);
$mail->Subject =  ' Can You View?';
$mail->Body= '<html><body><p><a href="http://www.amazon.com" >Click Here</a> to go shopping!</p></body></html>';

$mail->Send();

Open in new window


or this:
$Body= '<html><body><p><a href="http://www.amazon.com" >Click Here</a> to go shopping!</p></body></html>';
    $mail->IsHTML(true);  
    $mail->Subject  =   ' Can You View?';
 
	$mail->AltBody    = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
	$mail->MsgHTML($Body);
 
	$mail->CharSet="UTF-8";
 
    if(!$mail->Send())
    {
        echo "Mailer Error: " . $mail->ErrorInfo;
    }
    else
    {
        echo 'Message has been sent.';
    }

Open in new window

0
 

Author Comment

by:PegOC96
ID: 38857652
I had tried those and it still worked the same.  However, I've realized that the problem is in my email program, not the code.  I usually view my email using Entourage on a Mac.  And that is where it is not working. But when I view the same email through web mail or a mail program on a different computer (Outlook), it does appear correctly.
0

Featured Post

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
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.
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 count occurrences of each item in an array.

705 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