Solved

phpmailer sending email as hyperlinked

Posted on 2013-02-04
2
252 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
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

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

Suggested Solutions

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
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 dynamically set the form action using jQuery.

820 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