Solved

phpmailer sending email as hyperlinked

Posted on 2013-02-04
2
249 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
Comment Utility
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
Comment Utility
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Consider the following scenario: You are working on a website and make something great - something that lets the server work with information submitted by your users. This could be anything, from a simple guestbook to a e-Money solution. But what…
This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
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…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now