PHP - Php Mail() With Html/links?
I'm sending notifications from my website via php mail() function and I am trying to send links but they don't seem to have a link attached to them when they get to my email.
my code is: Code: [Select] $query = mysql_query("SELECT * FROM users WHERE id='$db_uid'"); $row = mysql_fetch_assoc($query); $from = "notify <notifications@site.com>"; $headers = "From:" . $from ."\r\n"; $headers .= 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $to = $row['email']; $subject = name($session, 'fl')." posted on your profile."; $message = '<html><body>'; $message .= nl2br(htmlentities($db_post)).'<br /><a target="_blank" href="www.site.com/#/profile&id='.$db_uid.'">Go to your profile</a>'; $message .= '</body></html>'; mail($to,$subject,$message,$headers); Similar TutorialsI am trying to use the php mail function and want to include links to a dynamic page, so I need to know how to do this... Something like: Code: [Select] $id=$_POST['id']; $mailto="email@address.com"; $mailsub="Subject"; $mailhead="From: other@address.com"; $mailbody="Your comment has been posted. You may view it by <a href='domain.com/page.php?id=".$id."'>clicking here</a>."; mail($mailto, $mailsub, $mailbody, $mailhead); I know this is not correct but I'm trying to figure out the actual way to do this... I have a notification system that notifies users of new comments, inside the email I have images, some of the logo, some of different people, everything shows up fine on my computer (yahoo email), however in the iPhones email application no images show up, there are just the blue squares with the question marks in them. I'm not sure what I'm missing. Code: [Select] $from = "Kithell <notifications@kithell.com>"; $headers = "From:" . $from ."\r\n"; $headers .= 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $subject = name($from_id, 'fl').$action; $message = '<html><body> <style>@charset "utf-8"; /* CSS Document */ .e-container { background-color: #FFF;position: relative;width: 90%;min-height:1px;margin-right: auto;margin-left: auto; } .e-container .e-m-header { padding: 2px; background-image: url(http://www.kithell.com/assets/tall-grey-header.png); background-repeat: repeat-x; border: 1px solid #CCC; background-position: bottom; display: block; text-align: center; } .e-container p { font-family: Arial, Helvetica, sans-serif; font-size: 12px; font-weight: normal; color: #666; vertical-align: text-top; display: inline-block; } .e-container .e-usr-photo { display: inline-block; margin: 10px; float: left; background-color: #F4F4F4; } .e-container p a { font-weight: bold; color: #3F60A3; text-decoration: underline; padding: 0px; float: left; margin-top: 0px; margin-right: 5px; margin-bottom: 0px; margin-left: 0px; } .e-container .e-quotes { font-size: 20px; font-weight: bold; color: #999; font-family: Tahoma, Geneva, sans-serif; display: block; padding: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 75px; margin-top:10px; } .e-container .e-message { font-size: 13px; color: #333; padding: 0px; margin-top: 0px; margin-right: 10px; margin-bottom: 0px; margin-left: 10px; clear: none; display: inline; }</style> <div class="e-container"><div class="e-m-header"><img src="http://www.kithell.com/assets/kithell-logo.png" /></div><img class="e-usr-photo" src="http://www.kithell.com/'.photo($from_id, 55).'" /><br /><p><a target="_blank" href="http://www.kithell.com/#/profile&id='.$from_id.'">'.name($from_id, "fl").' </a> '.$action.'<div class="e-quotes">"<p class="e-message">'.nl2br(htmlentities(stripslashes($message))).'</p>"</div></p></div></body></html>'; mail($to,$subject,$message,$headers); This topic has been moved to Other Web Server Software. http://www.phpfreaks.com/forums/index.php?topic=347009.0 So I have been working on my website for a while which all is php&mysql based, now working on the social networking part building in similar functions like Facebook has. I encountered a difficulty with getting information back from a link. I've checked several sources how it is possible, with title 'Facebook Like URL data Extract Using jQuery PHP and Ajax' was the most popular answer, I get the scripts but all of these scripts work with html links only. My site all with php extensions and copy&paste my site links into these demos do not return anything . I checked the code and all of them using file_get_contents(), parsing through the html file so if i pass 'filename.php' it returns nothing supposing that php has not processed yet and the function gets the content of the php script with no data of course. So my question is that how it is possible to extract data from a link with php extension (on Facebook it works) or how to get php file executed for file_get_contents() to get back the html?
here is the link with code&demo iamusing: http://www.sanwebe.c...-php-and-jquery
thanks in advance.
Hi Guys, I've got a contact form set up, where the user can submit their design they have created on the site. The file uploads to a directory titled "Uploads" and the idea would then be set up a link within an HTML style E-Mail, I've had a look at MIME-TYPE on the php.net manual. I've got the form to work to an extent, however the PHP variables are not being echo'ed out and the E-Mail looks like this : Quote <html> <body> <b>New Design by $name </b> <p>Contact Details...</p> Telephone : $telephone<br /> E-Mail : $email<br /> Design : <a href=http://wwww.mysite.co.uk/Mail%20Test/uploads/$upfile>$upfile</a> </body> </html> New EasyFluid Design Added My Code is as follows : Code: [Select] <?php $to = ""; // User E-Mail $subject = "New Design Added"; // The Subject //$target_path = "uploads/"; // $target_path = $target_path . basename( $_FILES['design']['name']); //if(move_uploaded_file($_FILES['design']['tmp_name'], $target_path)) { //} extract($_POST); $from = "From: {$_POST['name']} <{$_POST['email']}>"; // From (the field named "name" and the email field named "email" //Handle the Image $upfile = 'uploads/' .$_FILES['design']['name'] ; if (is_uploaded_file($_FILES['design']['tmp_name'])) { if (!move_uploaded_file($_FILES['design']['tmp_name'], $upfile)) { echo 'Problem : Could not move file to destination directory'; exit; } } $message = ' <html> <body> <b>New Design by $name </b> <p>Contact Details...</p> Telephone : $telephone<br /> E-Mail : $email<br /> Design : <a href=http://wwww.mysite.co.uk/Mail%20Test/uploads/$upfile>$upfile</a> </body> </html> '; // To send HTML mail, the Content-type header must be set $headers .= 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; mail($to, $from, $subject, $message, $headers); // HTML Style E-Mail ?> Any help on how I can correct this would be much appreciated. Thanks I have a html contact us page that i need to make functionable . the page is he http://www.saintgius...om/contact.html could someone show me what I need to add to it to make it work please.
I currently use this to send mail: Code: [Select] $message = "$quote_num<BR> PU: $city1, $state1. $zip1<BR> DL: $city2, $state2. $zip2<BR> $miles Miles<BR> Qty: $quantity $freight_type<BR> Lifgate: $liftgate<BR> Weight: $weight<BR> $description<BR> Quoted Price: $total_price"; The mail goes through fine, but it shows the <BR> in the meassage. Any help is appreciated! In my mail function, the $message parameter contains html tags such as <br><B> <a> etc etc.. But when I receive the email those tags are non functional. I do not get a bold text or a line break or a hyperlink as I should. How do i make it work? It works like a charm but the only problem I get when the page loads it SENDS an email without info of course because it sends it without someone pushing the submit button. Hereis my HTM Land PHP code Code: [Select] <form method="post" action="viewpage.php?page_id=5"> Email: <input name="email" type="text"><br> Message:<br> <textarea name="message" rows="15" cols="40"></textarea><br> <input type="submit"> </form> (note the action is in the page itself because thats where the php code is, now for the PHP code:) Code: [Select] <?php $to = "hidden for privacy"; $subject = "LoL Recruitment"; $email = $_REQUEST['email'] ; $message = $_REQUEST['message'] ; $headers = "From: $email"; $sent = mail($to, $subject, $message, $headers) ; if($sent) {print "Your mail was sent successfully"; } else {print "We encountered an error sending your mail"; } ?> For some reason I go to the page and it auto sends an email without waiting for me to "submit" the form... Is there any suggestions?? EDIT: I noticed its automatically doing the PHP script as soon as the page opens, because the HTML and PHP script is in the same "page" and not in different files, I understand this and I want it like this I dont want to have to create another file just for it to stop this bug. Theres got to be a way to pause the PHP script and activate it when the "Submit" button is pressed. Hi Everyone, I am trying to send email with the mail() function as per instructions at: http://php.net/manual/en/function.mail.php without success. The mail sends but when it arrives it doesn't render properly, I see all of the html tags with the data that's sent. My code is below: Code: [Select] <?php function processFormData($array, $form) { $errors = NULL; $message = NULL; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers = "From: <chuck@deneb-consulting.com>" . "\r\n"; $headers .="Cc: <tinwakr@bell.net>" . "\r\n"; $headers .= "Reply-to: <chuck@deneb-consulting.com>" . "\r\n"; $headers .= "X-Mailer: PHP/" .phpversion() . "\r\n"; foreach($array as $key => $value) { //if any of the form values are empty catch them and add to error array if(empty($value) && $key != 'submit') { //build error list $errors .= '"' . str_replace('_', ' ', $key) . '" is a required field!<br />'; } else if(!empty($value) && $key != 'submit') { //capture values and insert them into a session variable $_SESSION[$key] = $value; } } if(empty($errors)) { $message = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' . "\r\n"; $message .= '<html><head><title>' . $form .'</title></head>' . "\r\n" . '<body><table border="1">' . "\r\n"; foreach($array as $key => $value) { //regular expression check for phone number if(str_replace('_', ' ', $key) == 'Phone Number' && !preg_match("/^([1]-)?[0-9]{3}-[0-9]{3}-[0-9]{4}$/i", $value)) { return 'Please enter a valid phone number!'; } //regular expression check for email if(str_replace('_', ' ', $key) == 'Email Address' && !preg_match("/^[A-Z0-9._%-]+@[A-Z0-9][A-Z0-9.-]{0,61}[A-Z0-9]\.[A-Z]{2,6}$/i", $value)) { return 'Please enter a valid email address!'; } if($key != 'submit') { $message .= '<tr><td>' . $key . '</td><td>' . $value . '</td></tr>' . "\r\n"; } } $message .= '</table></body></html>' . "\r\n"; mail("chuck@deneb-consulting.com", $form, str_replace("_", " ", $message), $headers); return 'Thank you, someone will contact you shortly.'; } else { return $errors; } } ?> Thanks in advance for all replies, Chuck How do I send a html mail using php mailer? Currently it's sending a plain text mail. The actual html code. My code: SendMailEx($mail, "Your new password", $content); // inside func above $headers = 'From: ***' . "\r\n" . 'Reply-To: ***' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); Thank you All some help would be welcome. I'm having troubles with this simple email script. the idea: would like to make a mailing from a form. This works just fine. I'm having troubles with the mailing it self. What i posted he I edited my code to try without concatenating strings (*$_Post varible within xml). This however doesn't work eitherway. tests: all variables get set properly (tested with echo's so I cut them out to save you the reading :-)) connection gets established just fine All email adresses from the database pass by just fine. (also by echo :-)) I'm thinking semantic error but can't find the problem. Can anyone help me? <?php //make connection with database $con = mysql_connect("XXXXXXXXX","XXXXXXXXXX","XXXXXXXX"); if (!$con){ die('Could not connect: ' . mysql_error()); } mysql_select_db("dejuistestudiek", $con); //select all emails from mailing table if($con){ $sql = "SELECT * FROM mailing"; $result = mysql_query($sql); //prepare text for html mail $text = trim($_POST['TEXT']); $text = nl2br($text); $text = stripslashes($text); if($result){ while($row = mysql_fetch_array($result)){ // single recipient $to = $row['email']; // subject $subject = 'StuWay - Nieuwsbrief'; // message $message = '<html> <head> <title>Birthday Reminders for August</title> </head> <body> <p>Here are the birthdays upcoming in August!</p> <table> <tr> <th>Person</th><th>Day</th><th>Month</th><th>Year</th> </tr> <tr> <td>Joe</td><td>3rd</td><td>August</td><td>1970</td> </tr> <tr> <td>Sally</td><td>17th</td><td>August</td><td>1973</td> </tr> </table> </body> </html>'; // To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; // Additional headers $headers .= 'From: Do-Not-Reply@dejuistestudiekeuze.be' . "\r\n"; // Mail it $bool = mail($to, $subject, $message, $headers); } } } ?> Hi, I'm new to php and I'm trying to fill in an online form and send that info to emailaddresses with the code below, but it doesn't work AT ALL So I hope someone here could give me some guidelines to some success This is my code <?php $to = 'name@msn.com'; $subject = 'Nieuwsbrief'; // message $message = "<html>". "<head>"."<title>Nieuwsbrief</title>". "</head>"."<body>". "<center>". "<img src='http://www.xxxxxxxxxx.be/images/logo.png' style='padding: 30px 0 20px 0;' />". "</center>". "<center>". "<img src='http://www.xxxxxxxxxx.be/images/line.png' style='padding-bottom: 20px;' />". "</center>". "<h1 style='margin:10px 15px 5px 15px;font-family:Lucida Grande, Verdana, Arial, sans-serif;font-size:20px;color:#666;text-shadow:1px 1px 1px #cacaca;padding-bottom:5px;border-bottom: dotted 1px;'>". "{$_POST['txttitel']}". "</h1>". "<p>". "{$_POST['txtinhoud']}". "</p>". ."</body>"."</html>"; //get email list //open database connection $webspace='xxxxxxxxxx'; $username = "xxxxxxxxxx"; $password = "xxxxxxxxxx"; $database = "xxxxxxxxxx"; //connect to database $link=mysql_connect($webspace,$username,$password); @mysql_select_db($database) or die("<b>Unable to specified database</b>"); $query="SELECT fldemail FROM tblnieuwsbrief"; $result=mysql_query($query) or die('Error, query failed'); mysql_close($link); $row=1; $numrows=mysql_num_rows($result); $bccfield="Bcc: ". mysql_result($result,0,"fldemail"); while($row<$numrows) { $email=mysql_result($result,$row,"fldemail"); $bccfield .= "," . $email; //seperate by comma $row++; } $bccfield .= "\r\n"; // To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= $bccfield; // Mail it mail($to, $subject, $message, $headers); ?> thanks in advance Andreas OK so I am trying to send a email with the results of a submitted form to a specified email address. However when the email is received the data is not displayed rather the variable names are. See code and resulting email address below. // custom route code //Send Email // recipients $to = '********@*********.com'; // subject $subject = 'Jobs Form Submission!'; // message $message = ' <html> <head> <title>Jobs Form Submission!</title> </head> <body> Title: $job_title<br /> Company: $job_company<br /> Introduction: $job_intro <br /> Description: $job_description <br /> Required Qualifications: $job_req_qualifi <br /> Preferred Qualifications: $job_preerred_qualifi <br /> Contact Name: $job_contact_name <br /> Contact Company: $job_contact_company <br /> Contact E-mail: $job_contact_email <br /> Contact Phone: $job_contact_phone <br /> Contact Fax: $job_contact_fax <br /> </body> </html> '; // To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; // Additional headers $headers .= 'To: ******** <********@*********.com>' . "\r\n"; $headers .= 'From: $job_contact_email <$job_contact_email>' . "\r\n"; $headers .= 'Cc:' . "\r\n"; $headers .= 'Bcc:' . "\r\n"; // Mail it mail($to, $subject, $message, $headers); Email Address: Quote MIME-Version: 1.0 Content-type: text/html; charset=iso-8859-1 To: ********<******@**********.com> From: $job_contact_email <$job_contact_email@***********.com> Cc: <html> <head> <title>Jobs Form Submission!</title> </head> <body> Title: $job_title<br /> Company: $job_company<br /> Introduction: $job_intro <br /> Description: $job_description <br /> Required Qualifications: $job_req_qualifi <br /> Preferred Qualifications: $job_preerred_qualifi <br /> Contact Name: $job_contact_name <br /> Contact Company: $job_contact_company <br /> Contact E-mail: $job_contact_email <br /> Contact Phone: $job_contact_phone <br /> Contact Fax: $job_contact_fax <br /> </body> </html> Any pointers would be great. Thanks in advance 0_o Hi, I have a simple html form. <form action="mail.php" method="POST"> <p>Name</p> <input type="text" name="name"> <p>Email</p> <input type="text" name="email"> <p>Phone</p> <input type="text" name="phone"> <p>Message</p><textarea name="message" rows="6" cols="25"></textarea><br /> <input type="submit" value="Send"><input type="reset" value="Clear"> </form> I send a simple recap to e-mail through PHP. Simultaneously with this recapitulation, I would like to generate XML, which would send it in an e-mail attachment. Somehow it's not working. Would anyone help? <?php $name = $_POST['name']; $email = $_POST['email']; $phone = $_POST['phone']; $message = $_POST['message']; $formcontent=" From: $name \n Phone: $phone \n Call Back: $call \n Website: $website \n Priority: $priority \n Type: $type \n Message: $message"; $recipient = "**************"; $subject = "Contact Form"; $mailheader = "From: $email \r\n"; $doc = new DOMDocument('1.0', 'UTF-8'); $doc->formatOutput = true; $xmlRoot = $doc->createElement("xml"); $xmlRoot = $doc->appendChild($xmlRoot); $root = $doc->createElement('OrderDetails'); $root = $doc->appendChild($root); $ele1 = $doc->createElement('name'); $ele1->nodeValue=$name; $root->appendChild($ele1); $xml->saveXML(""); $mail->addStringAttachment($xml->asXML(), "xml.xml"); mail($recipient, $subject, $formcontent, $mailheader) or die("Error!"); echo "Thank You!" . " -" . "<a href='form.html' style='text-decoration:none;color:#ff0099;'> Return Home</a>"; ?> Thanks for any help!! I got a form which people can use to send a request for information to one or more recipients, depending on which recipients have been selected in the form. At the moment the HTML checkboxes all have a different name attribute and e-mails are sent using an if statement: <input type="checkbox" name="mr-a" value="A" /> A<br /> <input type="checkbox" name="mr-b" value="B" /> B<br /> <input type="checkbox" name="mr-c" value="C" /> C<br /> if (isset($_POST['mr-a'])) { // Send e-mail to A } if (isset($_POST['mr-b'])) { // Send e-mail to B } if (isset($_POST['mr-c'])) { // Send e-mail to C } I'm sure there's a much better way of doing this, and I think I should start by creating an array of checkboxes. But I can't figure out how to then use a loop to send the e-mails. Here's the code I got so far. I'm hoping that all I need is a loop where is says 'Send e-mails using a foreach loop?': <?php // Minimal validation: if (isset($_POST['submit'])) { $errors = array(); if (!$_POST['name'] ) { $errors[] = 'Error: no name entered'; } else { $name = $_POST['name']; } if (!$_POST['email'] ) { $errors[] = 'Error: no e-mail address entered'; } else { $email = $_POST['email']; } if (!count($errors)) { // Send e-mails using a foreach loop? } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <title>Lorem Ipsum</title> <!--[if lt IE 9]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]--> <link rel="stylesheet" href="style.css" type="text/css" /> </head> <body id="index" class="home"> <h1>Lorem Ipsum</h1> <p>Confirmation message.</p> </body> </html> <?php // Get out! exit(0); } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <title>Lorem Ipsum</title> <!--[if lt IE 9]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]--> <link rel="stylesheet" href="style.css" type="text/css" /> </head> <body id="index" class="home"> <h1>Lorem Ipsum</h1> <p>Contact A, B and/or C.</p> <?php if (isset($errors)) { foreach ($errors as $error) { echo("<p class=\"red\">$error<p>"); } } ?> <form method="post" action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>"> <fieldset> <legend>Who do you want to contact</legend> <input type="checkbox" name="mr[]" value="A" /> A<br /> <input type="checkbox" name="mr[]" value="B" /> B<br /> <input type="checkbox" name="mr[]" value="C" /> C<br /> </fieldset> <br /> <fieldset> <legend>Your Details</legend> <label for="name">Name</label><input type="text" name="name" value="<?php if (isset($_POST['name'])) {echo $_POST['name'];}?>"><br /> <label for="email">Email</label><input type="email" name="email" value="<?php if (isset($_POST['email'])) {echo $_POST['email'];}?>"><br /> <input type="submit" name="submit" value="Next" /> </fieldset> </form> </body> </html> I have a strange problem with my headers in my mail function.
This is how it looks like in my code:
$to = 'someone@email.com'; $subject = 'Question from website'; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html;charset=UTF-8' . "\r\n"; $headers .= 'From: ' . $email . "\r\n";When i send this i got the following message in my mailbox: Content-type: text/html;charset=UTF-8 From: web@somecompany.com Message-Id: <20140620142808.93D11A147@apache11.hostbasket.com> Date: Fri, 20 Jun 2014 16:28:08 +0200 (CEST) <html><head><title>Question from web</title><style type="text/css">body {background-color: #ffffff; font-family: verdana;}hr {color: #333;}div {width: 800px; margin: 25px auto;}h1 {color: #FFC421; font-size: 17px;}p {color: 2a2a2a; font-size: 15px;}</style></head><body><div><p><img src="imgs/tsc-logo.png"/></p><hr /><h2 style="color: #FFC421;">This customer asked a question</h2><br /><table style="width:800px"><tr><th style="width:250px"><h1>Customer:</h1></th><td></td></tr><tr><th>Name:</th><td>testname</td></tr><tr><th>Firstname:</th><td>testfirstname</td></tr><tr><th>E-mail:</th><td>testperson@company.be</td></tr><tr><th>Bericht:</th><td>This is a test</td></tr></table></div></body></html>I have allready found that the space between "Content-type" and "From" is not normal that indicates that a rule between MIME and Content-type is also present. But in my code there isn't any rule... How can this be possible? Thanks for the help! Hi guys, I'm trying to write a script that generates a multipart plaintext/HTML email with a pdf attachment. After much research and trial & error, I seem to have reached a wall. At the moment, I am testing in gmail, hotmail and Outlook 2003. Gmail displays the HTML alternative of the message and attaches the pdf document, while hotmail & Outlook only attach the pdf without displaying either of the message alternatives. Here is the code: // Error display ini_set ('display_errors', 1); error_reporting (E_ALL | E_STRICT); // Setting a timestamp date_default_timezone_set('Australia/Perth'); $timestamp = date("d/m/y H:i:s", time()); // Create a boundary string. It must be unique, so we use the MD5 algorithm to generate a random hash $random_hash = md5(time()); // Read the attachment file contents into a string, encode it with MIME base64 & split it into smaller chunks $attachment = chunk_split(base64_encode(file_get_contents("success.pdf"))); // Create the Plain text message to be sent in the email body $content_text = "Hello, World!! \nIs this a Plain Text alternative?"; // Create the HTML message to be sent in the email body $content_html = "<html><body><h1>Hello, World!!</h1><p>This is <b>HTML</b> formatting.</p></body></html>"; // Sending the email $to = "$email"; $subject = "Test5-3.php :: $timestamp"; $headers = "From: The Company <webmaster@example.com>\n"; $headers .= "MIME-Version: 1.0\n"; $headers .= "Content-Type: multipart/mixed; boundary=\"$random_hash\"\n"; $headers .= "--$random_hash\n"; $headers .= "Content-Type: application/pdf\n"; $headers .= "Content-Transfer-Encoding: base64\n"; $headers .= "Content-Disposition: attachment; filename=\"success.pdf\"\n\n"; $headers .= "$attachment\n"; $message = "Content-Type: multipart/alternative; boundary=\"$random_hash\"\n"; $message .= "Content-Type: text/plain; charset=\"iso-8859-1\"\n"; $message .= "Content-Transfer-Encoding: 7bit\n"; $message .= "$content_text\n"; $message .= "--$random_hash\n"; $message .= "Content-Type: text/html; charset=\"iso-8859-1\"\n"; $message .= "Content-Transfer-Encoding: 7bit\n"; $message .= "$content_html\n"; $message .= "--$random_hash--"; // Send the data in an email $mail_sent = @mail ($to, $subject, $message, $headers, "[email]-froot@clarebyrnedesign.com.au[/email]"); (That's not the full script, but it is the relevant part of it. The full script is attached.) Other variations of this code I have tried out include: - surrounding all the variables with ". .", eg: $headers .= "--".$random_hash."\n"; - sending the entire function as headers, instead of splitting it into message and headers, eg: $headers = "From: The Company <webmaster@example.com>\n"; $headers .= "MIME-Version: 1.0\n"; $headers .= "Content-Type: multipart/mixed; boundary=\"$random_hash\"\n"; $headers .= "--$random_hash\n"; $headers .= "Content-Type: application/pdf\n"; $headers .= "Content-Transfer-Encoding: base64\n"; $headers .= "Content-Disposition: attachment; filename=\"success.pdf\"\n\n"; $headers .= "$attachment\n"; $headers .= "Content-Type: multipart/alternative; boundary=\"$random_hash\"\n"; $headers .= "Content-Type: text/plain; charset=\"iso-8859-1\"\n"; $headers .= "Content-Transfer-Encoding: 7bit\n"; $headers .= "$content_text\n"; $headers .= "--$random_hash\n"; $headers .= "Content-Type: text/html; charset=\"iso-8859-1\"\n"; $headers .= "Content-Transfer-Encoding: 7bit\n"; $headers .= "$content_html\n"; $headers .= "--$random_hash--"; Does anyone know why I would be having this problem? It seems that nothing I've tried will work!! Thanks $to=sammieave@ave.com,samuel@ave.com; $subject = "New Event Logged"; $message = "Test"; $headers = "From: Samuel<sammieave@ave.com>;\r\n"; $headers .= "Content-Type: text/html"; mail($to,$subject,$message,$headers); I am having the above code but unfortunately the error I am getting is: Warning: mail() [function.mail]: SMTP server response: 550 Requested action not taken: mailbox unavailable or not local in C:\xampp\htdocs\CRM\support\mailer.php on line 139 Hi There, Is there any way that when a user submits a form, but places a link inside - for example: It is located at this location: http://mylink.com Is there any way that PHP can pick up the fact that there is a link there and tag it correctly so it is clickable? Cheers Matt |