PHP - Link In Email Not Working, X-msg In Front Of Link?
here's my code that i've used to send an email.
Code: [Select] $link = "<a href=\"http://www.example.com/" . $num . "\">" . $num . "</a>"; $query = "SELECT content FROM emails"; $result = mysql_query($query) or die(); $email_content = mysql_result($result, 0); $email = sprintf($email_content, $first, $name, $from, $link, $record, $rec, $inc, $max); $email_body = stripslashes(htmlentities($email, ENT_QUOTES, 'UTF-8')); // this is sent to another php script via post.... $subject = $_POST['subject']; $message = nl2br(html_entity_decode($_POST['email_body'])); $to = "me@whatever.com"; $charset='UTF-8'; $encoded_subject="=?$charset?B?" . base64_encode($subject) . "?=\n"; $headers="From: " . $userEmail . "\n" . "Content-Type: text/html; charset=$charset; format=flowed\n" . "MIME-Version: 1.0\n" . "Content-Transfer-Encoding: 8bit\n" . "X-Mailer: PHP\n"; mail($to,$encoded_subject,$message,$headers); in the db, emails.content is of the text type and contains several lines of text with %4$s which inserts the value of $link into the body. when the email arrives, there is a link and it appears fine, with the value of $num hyperlinked. however when you click on it it doesn't go anywhere. when copying the link location from the email it gives me x-msg://87/%22http://www.example.com/16 what is x-msg? how can i get this to work properly? Similar TutorialsCode: [Select] <?php if(isset($_SERVER['PHP_AUTH_USER'])) { echo "<a href='schedule.php'>Request A Skype Session</a>"; } ?> works great for someone that islogged in my htpasswd, however, I would like to hide Code: [Select] <a href="/members/index.php">Login</a> if they are logged in, how do i go about doing the opposite of the first code i linked...sorry if it sounds complicated Hi, I'm new here and new to php. My first attempt at a php project actually so I'm hoping to get some help. I want people to register at my site but I don't want them to put false emails on it. So I used the coding from this website http://www.phpeasystep.com/workshopview.php?id=24 to provide codings for forms and email confirmation links. The process worked up to when I click on the confirmation link (at testing) from the email and the link returns to a blank webpage. No data is transferred from "temp_members_db" table to "registered_members" table at all. I'll attach print screen of my tables. Hoping that someone can point out to me where I'm going wrong as I can't seem to get myself out of this one. Hi, n0obie here. I'm trying to identify where my customers are coming from via emails I've sent/received. However, many email providers (namely Gmail) have circumvented this by disallowing IP address geolocation/image caching. Hi all I have a script that creates an email message, but I want to add a link to it to take the user to PayPal. Here's my code: $headers = "MIME-Version: 1.0\n"; $headers .= "Content-type: text/html; charset=utf-8\n"; $headers .= "From: '".$_SERVER['HTTP_HOST']." Booking System' <info@".$_SERVER['HTTP_HOST']."> \n"; $subject = "Booking Confirmed!"; $message = "Dear ".$name.",<br /> <br /> This is confirmation of your booking. <br />"; $message .= "<table cellspacing=0 cellpadding=4 border=0>"; $message .= "<tr><td>Date</td><td>Time From</td><td>Time To</td></tr>"; $message .= $tempVar; $message .= "</table>"; $message .="<br />Reservation Status: Confirmed<br/>"; $message .="<br /><br />Kind Regards, <br /> ".$_SERVER['HTTP_HOST']." Team"; mail($email,$subject,$message,$headers); Can anyone help me add a line to the above to add the link in? Many thanks Pete Is there a way to add an HTML link in a Text E-mail that was generated by PHP? I am trying to create an e-mail that looks like this... Quote Dear Member, Your password was re-set, and the following Temporary Password has been assigned: Use this temporary password to Log In. Debbie Hi All, I'm sending an email with a link to a web page with a form on. Code: [Select] <tr style="padding:10px;"> <td align="center"> <a style="text-decoration:none;" href="http://www.foo.co.uk/bar.php?id=123"> <img src="/header.jpg" border="0" style="display: block;" width="380" height="64" alt="Logo" /> </a> </td> </tr> I currently GET the id from the URL and add it to a hidden field in the form which then sends the ID to the database on submit so I know from which email the user came from to fill out the form. This doesn't always work as I guess some people move from the form page to look at other pages on my site then come back to fill in the form. I think I need to use SESSION to keep the id 'active' but cannot figure out how to GET the id from the URL and put it into a SESSION, alas I am struggling to even start and finish a basic SESSION. Thanks in advance, Ben. I am sending emails using PHPMailer. My configuration is below.
When adding a link to the message, should I use anchor tags? Both seem to work. What is the implication to recipients who are not using HTML email?
On a side note, if anything below seems wrong, please let me know.
Thanks
$msg='<p>Hello</p><p>Link: http://phpmailer.worxware.com/</p><p>Link: http://phpmailer.worxware.com</p><a href="http://phpmailer.worxware.com">http://phpmailer.worxware.com</a>'; $mail = new myPHPMailer(true); $mail->AddReplyTo('myEmail@xxx.com', 'Michael Reed'); $mail->SetFrom('myEmail@xxx.com', 'Michael Reed'); $mail->AddAddress('johndoe@xxx.com', 'John Doe'); $mail->Subject = "Here is your email"; //AltBody property need not be sent since PHPMailer will create an alternate automatically $mail->MsgHTML($message); return ($mail->Send()); class myPHPMailer extends PHPMailer { public function __construct($allow_exceptions=false){ $this->isSMTP(); $this->SMTPDebug = 0; $this->Host = "smtp.gmail.com"; $this->Port = 587; $this->SMTPSecure='tls'; // sets the prefix to the server. Used for gmail only. $this->SMTPAuth = true; $this->Username = 'xxx'; $this->Password = 'xxx'; } } guys this function below posts the data into table and im also able to send a link in email with caregory name but the issue is getting the id to the particular post i got no isea how do i get that? Code: [Select] function insert($postData) { $postData['description'] = clean($postData['description']); if(!EmailExists($postData['email'])){ $sql = " INSERT INTO tbl_emails SET email = '".$postData['email']."', postersname = '".$postData['postersname']."', phone = '".$postData['phone']."' "; executeSql($sql); } if(empty($_FILES['image']["name"])){ $sql = " INSERT INTO tbl SET title = '".$postData['title']."', image = '', postersname = '".$postData['postersname']."', category = '".$postData['category']."', type = '".$postData['type']."', state = '".$postData['state']."', location = '".$postData['location']."', email = '".$postData['email']."', phone = '".$postData['phone']."', description = '".$postData['description']."', time = '".time()."' "; executeSql($sql); }else{ global $uploadPath; $remove_symbols = array('+', '=', '-', '{', '}', '$', '(', ')','&'); $removed_symbols = str_replace($remove_symbols, "_", $_FILES['image']['name']); $randomnum=rand(00000000,99999999); $imagepath = uploadFile($_FILES['image'], $uploadPath); $image = new SimpleImage(); $image->load($imagepath); $image->resize(250,280); $resize_rename = $uploadPath.$randomnum._.$removed_symbols; $image->save($resize_rename); unlink($imagepath); //delete the original file $sql = " INSERT INTO tbl SET title = '".$postData['title']."', image = '".$resize_rename."', postersname = '".$postData['postersname']."', category = '".$postData['category']."', type = '".$postData['type']."', state = '".$postData['state']."', location = '".$postData['ocation']."', email = '".$postData['email']."', phone = '".$postData['phone']."', description = '".$postData['description']."', time = '".time()."' "; executeSql($sql); } } Hey guys im having a problem with emailing a link using local host mail. I'm using out look express with Mercury. I shorten the email below as much as possible. Its really wierd the target for the link is correct but clicking on it gives me this res ieframe.dll res://ieframe.dll/syntax.htm#http//localhost/stargate/users/account_settings.php? npd=82b1e0df295ee681f1fa2f213ade823d $to = $_POST['resendemail']; $from = "stargate@localhost.com"; $subject = "Stargate System Lords Password Recovery"; $message = "<html> <body background=\"#4B4B4B\"> <h1>Stargate System Lords Password Recovery</h1> Dear ".$users1['name'].", <br> <center> <a href="localhost/stargate/users/account_settings.php?npd=$new_password ">Log In</a> <p> <br /> </font> </body> </html>"; $headers = "From: Stargate Game Password Recovery <stargate@localhost.com>\r\n"; $headers .= "Content-type: text/html\r\n"; mail($to, $subject, $message, $headers); Not sure if this relates more to PHP or Javascript/jQuery, but is there a way to attach a file to an email client (i.e Outlook), when user click on a link/button? I have a link that generates a PDF and I want it so that, when someone click on a link, it will open up their email client with the PDF already attached, and subject already fill in. I know, you can use <a href="mailto:..." but that only opens up the mail client. I also need to attach a file with a subject fill in. Is this doable with PHP or Javascript? Hey guys, I'm going to start working on a simple php/mysql project, and wondering if you guys could point me in the right direction. Here is what I want to do: 1. User is presented with a simple form asking a series of questions (including email address) 2. Based on the answers, a specific download link is emailed to the user 3. store all inputted information in the database. I'm still not sure if I want the email process to be automated, or "held" until the information is reviewed, then download link sent. Does anyone know if a script already exist for this? I don't need to create user accounts, I just want to obtain user information every time they want to download something. Thanks for any help. Hi all I have a page which has the following link on it: <a href="view-listings.php?live&id=<?php echo $showlistings['id'] ?>" title="Click here to make this listing live"><img src="../images/not-live.gif" width="20" title="Click here to make this listing live" alt="Click here to make this listing live" /></a> Which runs this part of the script: if (isset($_GET['live'])) { $liveid = $_GET['id']; mysql_query("UPDATE `listings` SET live = 1 WHERE id = '".$liveid."'"); header ("Location: view-listings.php"); } Which works great on Safari but it says "Page cannot be displayed" on a PC running Internet Explorer 8? Please help! Pete Hi I've got this database I created with fields ProductId ProductName Image I've managed to get it to list the ID,productname, and Image urls in a list. My next step is to have the image field actually display an image and make it clickable: heres what I've done so far: Code: [Select] <?php $con = mysql_connect("localhost","root",""); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("productfeed", $con); $result = mysql_query("SELECT * FROM productfeeds"); echo "<table border='0'> <tr> <th>Firstname</th> <th>Lastname</th> <th>Image</th> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['ProductID'] . "</td>"; echo "<td>" . $row['ProductName'] . "</td>"; echo "<td>" . $row['ImageURL'] . "</td>"; echo "</tr>"; } echo "</table>"; mysql_close($con); ?> Heres what I want to do: Code: [Select] while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['ProductID'] . "</td>"; echo "<td>" . $row['ProductName'] . "</td>"; // my changes beneath echo "<td>" . <a href="<?php echo $row['ImageURL'];?>"> <img src="<?php echo $row['LinkURL']; ?>"> </a>. "</td>"; echo "</tr>"; } echo "</table>"; mysql_close($con); ?> Can you guys point me in the right direction? Many thanks Hello.
I have a bit of a problem. When I fetch the link field from the database.i don't see an actual link on the page.
One more thing, what type of field should I use to store the link in the database? Probably there is where I went wrong.
All help is
Hi, I have a directory page the displays all names beginning with B across 3 columns, that part works fine but when I try to add a link on each of the results the link doesn't work. It's not picking up the $id or $name variables for some reason, can anyone tell me why this is? Any help would be very much appreciated. Code: [Select] <?php $data = mysql_query("SELECT id, name FROM new WHERE name LIKE 'B%' ORDER by name ASC LIMIT 30"); $prev_row =''; echo '<table width="690px">'; while($info = mysql_fetch_array( $data )) { $letter = strtoupper(substr($info['name'],0,1)); if ($letter != $prev_row) { if($count % 3) { for ($i = ($count % 3); $i < 3; $i++) echo '<td> </td>'; echo '</tr>'; $count =0; } $prev_row = $letter; echo '<tr><td class="directory-letter" colspan="3">',$letter,'</td></tr>'; } $id = $row['id']; $name = $row['name']; if ($count % 3 == 0) echo '<ul><tr>'; $count++; echo '<td width="230px"><li class="directory-store-name"><a href="directory/name.php?id=$id" title="$name" />', $info['name'],"</li></td>\n"; if ($count % 3 == 0) echo '</tr></ul>'; } if($count % 3) { for ($i = ($count % 3); $i < 3; $i++) echo '<td> </td>'; echo '</tr>'; } echo '</table>'; ?> Hello all, I'm new to any kind of coding, but I recently graduated college with an English degree and decided to try to become a technical writer, but quickly realized I would need to learn some basic coding to publish stuff as many companies are moving away from paper. Anyway, that's the background to why I'm about to ask a really simple question: I wrote a login script, and it rejects people correctly who don't have the correct credentials, and it accepts the people that do, but while the failed attempts send the appropriate alert (the alert also pops up when u first open the page, which if you all can figure out why and stop it, that would be awesome, but its not the main problem), for those who do log in it does not send them to the link that I'm trying to send them to upon log in. Instead, they stay on the same page, but the login text boxes are gone. Any help would be appreciated, thanks. Here is the code: <html> <body style="background-color:rgb(240,230,200);font-family:Times;font-size:110%;"> <p style="text-align:center;font-family:Arial;font-size:250%"> ///text removed for privacy///</p> <p style="text-align:center;font-family:Arial;font-size:200%"> ////text removed for privacy </p> <CENTER><img src="////removed for privacy/////" width="700" height="500"/></Center> <p style="text-align:center;"> To access the site, please use enter your User ID and Password. </p> <center> <?php error_reporting (E_ALL ^ E_NOTICE); ?> <?php session_start(); include("passwords.php"); if ($_POST["ac"]=="log") { if ($USERS[$_POST["username"]]==$_POST["password"]) { $_SESSION["logged"]=$_POST["username"]; } else { echo 'Please enter a vaild Username and Password'; }; }; if (array_key_exists($_SESSION["logged"],$USERS)) header("index.html"); else { echo "<script>alert('Please enter valid Username and Password')</script>"; echo '<form action="login.php" method="post"><input type="hidden" name="ac" value="log"> '; echo 'Username: <input type="text" name="username" /><br />'; echo 'Password: <input type="password" name="password" /><br />'; echo '<input type="submit" value="Login" />'; echo '</form>'; } ?> </center> </body> </html> The link in the email is showing up as plain text and not as a link. How do I fix this? if($notify === true) { $sender = fetch_user_info(fetch_username_by_id ($user_info['uid'])); $receiver = fetch_user_info(fetch_username_by_id ($uid)); $sender['displayName'] = ucwords("{$sender['firstname']} {$sender['lastname']}"); $receiver['displayName'] = ucwords("{$receiver['firstname']} {$receiver['lastname']}"); $body = "<table>Hi ${receiver['firstname']},\n \n <a href=\"http://mysite.com/u/{$sender['username']}\" title=\"Go to {$sender['displayName']}'s profile\">{$sender['displayName']}</a> would like to be.\n Please sign in to .\n \n The who</table>"; mail($receiver['email'], 'fssd', $body, 'From: noreply@site.com'); // return $sender; } This link is driving me crazy <a id ="savepdf" href="invoice.php?invoice_id=<?=$invoiceID?>"value="Save This Invoice"><button class="block" id ="printbtn" onclick="myFunction()";>Save Invoice</button></a>
when a user selects this link it works ok saves a pdf file to a folder on server. i want to relocate after link submitted. If i use this link it does redirect but does not save the pdf file to folder on server <a id ="savepdf" href="invoice.php?invoice_id=<?=$invoiceID?>"value="Save This Invoice" onclick="window.location.href='mypage.php'; ;return false;"><button class="block" id ="printbtn" onclick="myFunction()";>Save Invoice</button></a> I have to make a calendar which can go back & forth between years and months. when you click on the month it is supposed to show the calendar of that month and the year you clicked. you can view the site where i can put the php. http://helios.ite.gmu.edu/~easad/lab7.php Thanks a bunch! Code: [Select] if ($_GET["year"]=="") { $year=date("Y"); $previousYear = $year-1; $nextYear = $year+1; } else { $year=$_GET["year"]; $previousYear = $year-1; $nextYear = $year+1; } if ($_GET["month"]=="") { $month=date("n"); } else { $month=$_GET["month"]; } Hi Support, I have a form, where it collects user description input. I can collect the inputs and store it with newline. The issue is - how to collect the http link to actual hyperlink ref during display. The following is my code: <textarea name="description" cols="50" rows="10" id="description"><?php echo str_replace("<br>", "\n", $description);?></textarea></td> For example, User input: Hi, Check it out - http://www.google.com/ I would like to display google link as href so that Viewers can click the link and go to the page. Right now, it is not href and user need to copy the link to new tabs or pages and then it can come. Thanks for your help. Regards, Ahsan |