Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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