Chris Fadu Uba
Chris Fadu Uba

Reputation: 133

Sendmail via php with dynamic url doesn't work

I have a big problem! I need to track what the users are doing on my site. As a way to resolve it I crated a sendmail function in order to send me an email every time a user clicks on a button. The code is this:

<div class="buy">
<a onclick="target='_blank'" href="<?php echo $this->product['from'];?>">

<?php
// The message
$message = "A new buy";
$link = $this->product['from'];

// Send
mail('[email protected]', '@buy PRODUCT', $message, $link);
?> 

<img src="http://xxx.com/data/images/xxx.jpg" alt="Comprar"       />                            
</a>
</div>

The message I receive is

"A new buy

"

And it should look like:

"A new buy

http://www.xxxx.com"

Anyone can help me with this problem?

Upvotes: 0

Views: 158

Answers (4)

Ayman Farhat
Ayman Farhat

Reputation: 2080

Just concatenate any data related to your message to your $message variable and just pass that $message variable into the mail function. For example: $message = $message." Link: ".$link and then mail('[email protected]', $message)

Upvotes: 0

Eugen
Eugen

Reputation: 1386

try this

mail('[email protected]', '@buy PRODUCT', $message.$link);

Upvotes: 0

Paul Alex
Paul Alex

Reputation: 30

mail('[email protected]', '@buy PRODUCT', $message.$link);

Upvotes: 0

demonslayer
demonslayer

Reputation: 66

You need 2 only pass one message parameter.

$message = $message.$this->product['from'];
mail('[email protected]', '@buy PRODUCT', $message);

Upvotes: 1

Related Questions