Solved

phpmailer sending email as hyperlinked

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
php function to remove a file 31 43
ebay devID, appID, certID, userToken 2 31
How would I do this...? 2 28
Number of hours between date in DB and now 8 18
Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
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 …

831 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