hello,
i am trying to add a feature in my contact form that create a link with visitors submitted 'TITLE' and 'URL'.
Have a look at this code!
***In this code $attn = Visitors submitted URL and $visitor = Visitors submitted title.

$todayis = date("l, F j, Y, g:i a") ;
$attn = $attn ;
$subject = $attn;
$notes = stripcslashes($notes);
$message = " $todayis [EST] \n
Attention: $attn \n
Message: $notes \n
From: $visitor ($visitormail)\n
Browser Info: $httpagent \n
Referral : $httpref \n
[B]<a href='$attn '>$visitor </a>[/B]
";

here i have added a code like this

<a href='$attn '>$visitor </a>

but its not works!It send data in in my e-mail this way: <a href='http://www.submittedurl.com '> Submitted Title </a> but i wanna get it as a link like: Submitted Title in my email.
So what to do, any help? Thanks.

Recommended Answers

All 10 Replies

Post your full mail function (with headers) here...

Your email mime type is text, you need HTML type in header.

$headers .= "Content-Type: text/html; charset=\"iso-8859-1\"\n";
commented: helpful +4

Actually i am new to php coding!:-/
Here is the full code.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>FeedBack</title>
</head>
<body>
<?php
require_once('recaptchalib.php');
$privatekey = "xxxxxxxxxxxxxxx";
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if (!$resp->is_valid) {
die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
"(reCAPTCHA said: " . $resp->error . ")");
}
$httpagent = $_POST['httpagent'];
$visitor = $_POST['visitor'];
$visitormail = $_POST['visitormail'];
$notes = $_POST['notes'];
$attn = $_POST['attn'];
if (eregi('under construction:', $notes)) {
die ("Do NOT SUBMIT THIS TYPES OF FEEDBACK! ! ");
}
if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,".")))
{
echo "<h2>Use Back - Enter valid e-mail</h2>\n";
$badinput = "<h2>Feedback was NOT submitted</h2>\n";
echo $badinput;
die ("Go back! ! ");
}
if(empty($visitor) || empty($visitormail) || empty($notes )) {
echo "<h2>Use Back - fill in all fields</h2>\n";
die ("Use back! ! ");
}
[B]$todayis = date("l, F j, Y, g:i a") ;
$attn = $attn ;
$subject = $attn;
$notes = stripcslashes($notes);
$message = " $todayis [EST] \n
Attention: $attn \n
Message: $notes \n
From: $visitor ($visitormail)\n
Browser Info: $httpagent \n
Referral : $httpref \n
";[/B]
$from = "From: $visitormail\r\n";
mail("mail@example.com", $subject, $message, $from);
?>
<p>
<h1>Thankyou, We got your mail!</h1>
</p>
</body>
</html>

how to modify it's header?

Replace the line

$from = "From: $visitormail\r\n";

with

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

Thank @Karthik
It works great.

oh one think!
i wanna add a site preview but this code don't works:

<a href='$attn' target="_blank"> <img alt='$attn' src='http://cligs.websnapr.com/?url=$attn' /> </a>

It shows a error, help me!!! How i can do this?

Check the 'src' of <img> tag. What error shows in your browser?

i find the problem, target="_blank" need to convert to target='_blank'
Is there any way to extract visitors submitted sites TITLE, DESCRIPTION and KEYWORDS in my mail when visitors submit their website using this mail form?
I mean when some one submit their website url(www.example.com) and mail me using this e-mail form then this mail from will extract its(www.example.com) TITLE, DESCRIPTION and KEYWORDS and then send it in my mail, is it possible to do and how to do it?
Thankyou

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.