Jump to content

Problem including href link in mail message


Viola

Recommended Posts

Hi

 

I'm having a bit of trouble including a link to my website in an email and was wondering if anyone can help?

 

Just before I call the mail function, I put:

echo "<pre>"; print_r($msg['body']); echo "</pre>";

so that I can see if the path is being passed into the mail function correctly.

 

The link is passed into mail() as:

<a href="http://mydomain.com/support/support_downloads.php">Click here to go to our downloads page</a>

 

However, when I get the email (which for testing purposes I'm sending to myself), it says this:

<a href="http://../support/support_downloads.php">Click here to go to our downloads page</a>

 

Please can you can help me with trying to figure out what I'm doing wrong?  Thanks in advance.

 

Viola

http://php.net/manual/en/function.mail.php

 

you need to set the email type to text/html for html to work via the headers

$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";

Thanks mikesta707.

 

Unfortunately, I'm already doing that.  The rest of the html message displays fine.

 

In case it sheds any more light --

I looked at the message source and that shows the link as

<a href="../support/support_downloads.php">Click here to go to our downloads page</a>

 

For some reason, mail() seems to be taking my url and converting it to a relative path.  Not sure why or what I need to do to get it to accept my url as-is.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.