IvanTW Posted January 30, 2015 Share Posted January 30, 2015 Hi, I am new to this forum and I came here because I am a website owner that is a novice in php coding and I want to adjust the coding my web designer created, because I want to update my auto email when members sign up to my site. I found my signup.php page and found the secton where the contents of the auto email are housed but I have no way (or atleast I don't know the way) to test my coding adjustments without going through the signup process on my site and I don't want to do that multiple times just to check code, so I decided to see if I could ask the questions here and maybe someone can "eyeball" my coding adjustments and ensure that they work OR maybe you can instruct me how I can test my code. Keep in mind, this is not an actual page on my site, it's the auto email when users signup. It's sent from my signup.php page once the signup button is "clicked". 1. I'll provide a snippet of the code my webdesigner setup and that should work fine 2. I'll provide my changes to the email contents (basically text, image and html links). Hopefully there is someone who can assist. Thanks A BILLION!!! -Ivan Below is the original code from my webmaster, shouldn't be anything wrong with this code. (You'll notice the links aren't html text links, I wanted to change that) $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= "From: mixrevu.com <noreply@mixrevu.com> \r\n"; $headers .= "Reply-To: noreply@mixrevu.com \r\n"; $headers .= "X-Mailer: PHP/" . phpversion(); $to = $_POST["email"]; $subject = "Website Sign Up \r\n"; $body = "<p><img src='http://www.mixrevu.com/img/logo.png'></p> \r\n"; $body .= "<p style='font-weight:bold;'>Welcome! We absolutely love new members!</p> \r\n"; $body .= "<p>Your signup is now complete.</p> \r\n"; $body .= "<p>Your Login details are:<br> \r\n"; $body .= "Current Email: ".$_POST["email"]."<br> \r\n"; $body .= "Password: ".$_POST["pwd"]."</p> \r\n"; $body .= "<p style='font-weight:bold;'>Hang on to this email just in case you forget those details. </p> \r\n"; $body .= "<p>If you need any assistance, don’t worry we are here to HELP! - support@mixrevu.com</p> \r\n"; $body .= "<p style='font-weight:bold;'>Start Here</p> \r\n"; $body .= "<p>#1 Complete your profile so we know more about why you love pro audio mixing.<br> \r\n"; $body .= "#2 Join the conversation in our forum, we’d love to hear from you. - http://forum.mixrevu.com<br> \r\n"; $body .= "#3 Submit your mix in the mix-revu to get feedback you can’t get anywhere else on the internet and maybe even win a winner’s spot on our homepage! - http://www.mixrevu.com<br> \r\n"; $body .= "#4 Our merch store is the place to show others you are a proud member of the mixrevu community, check it out! - http://merch.mixrevu.com<br> \r\n"; $body .= "#5 We need photos of our members in their mix environment, post some!</p> \r\n"; $body .= "<p>-mixrevu team! </p> \r\n"; mail($to, $subject, $body, $headers); Below are my adjustments to the body of the email (it includes image links for social media, and html text links replacing the basic website address links) ** All of the changes I made are within the $body of the email. $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= "From: mixrevu.com <noreply@mixrevu.com> \r\n"; $headers .= "Reply-To: noreply@mixrevu.com \r\n"; $headers .= "X-Mailer: PHP/" . phpversion(); $to = $_POST["email"]; $subject = "Website Sign Up \r\n"; $body = "<p><img src='http://www.mixrevu.com/img/logo.png'></p> \r\n"; $body .= "<p style='font-weight:bold;'>Welcome! We Absolutely Love New Members!</p> \r\n"; $body .= "<p style='font-weight:bold;'>Follow Us For Mixrevu.com Updates: <a href='https://www.facebook.com/mixrevu'> <img border='0' alt='Facebook page' src='http://www.mixrevu.com/images/Facebook-logo-300x300.jpg' width='45' height='45'> </a> <a href='https://www.twitter.com/MIXREVU'> <img border='0' alt='Twitter page' src='http://www.mixrevu.com/images/Twitter_logo_blue.png' width='45' height='35'> </a> <a href='https://plus.google.com/+Mixrevu'> <img border='0' alt='Google plus' src='http://www.mixrevu.com/images/google_plus_03.png' width='60' height='45'> </a></p> \r\n"; $body .= "<p>Your signup is now complete.</p> \r\n"; $body .= "<p>Your Login details are:<br> \r\n"; $body .= "Current Email: ".$_POST["email"]."<br> \r\n"; $body .= "Password: ".$_POST["pwd"]."</p> \r\n"; $body .= "<p style='font-weight:bold;'>Hang on to this email just in case you forget those details. </p> \r\n"; $body .= "<p>If you need any assistance, don’t worry we are here to HELP! - support@mixrevu.com</p> \r\n"; $body .= "<p style='font-weight:bold;'>Start Here</p> \r\n"; $body .= "<p>#1 Complete your profile by registering in the <a href='http://goo.gl/d2gBZX'>Forum</a>. This is where you’ll have access to our downloads when we upload them. Only members who’ve logged in to both will have access. You can also find previous Head2Head downloads <a href='http://goo.gl/L8gwXP'>HERE</a> that you can use for practice.<br> \r\n"; $body .= "#2 Be sure to check out the Mixrevu <a href='http://goo.gl/AUvo87'>Head2Head Rules</a>.<br> \r\n"; $body .= "#3 Mixrevu Head2Head Free Downloads are announced via Newsletters to all members first. You’ll automatically receive those as a site member. **If you have music of your own you want in a Head2Head, upload that too!!! We have genre specific spaces available.** <a href='http://goo.gl/FqzG6o'>Here’s how to upload</a>.<br> \r\n"; $body .= "#4 Our Sites Best <a href='http://goo.gl/5L8lzM'>Trivia</a>, <a href='http://goo.gl/yShmdh'>Quizzes</a> & <a href='http://goo.gl/smfV8z'>Audio Articles</a> are in our <a href='http://goo.gl/4Nmfqn'>Audio Blog</a>. - Exclusive content guaranteed to improve your mix process.<br> \r\n"; $body .= "#5 Upload your photo to our <a href='http://goo.gl/DOMMbP'>photo wall</a>, If you win a Head2Head this will be your featured photo!<br> \r\n"; $body .= "#6 Ever wanted to understand your studio better? We cover everything from EQ, Compression, Monitors, TDR, to Studio Acoustics & More in the <a href='http://goo.gl/KjCYxn'>Signal Path Series</a> .<br> \r\n"; $body .= "#7 <a href='http://goo.gl/kxQOik'>Exclusive Audio Engineer T-Shirts</a> & <a href='http://goo.gl/6KC31j'>Exclusive Downloads</a> you won’t find anywhere else are in our shop! Everything is ON SALE & Free Shipping in the U.S.!</p><br> \r\n"; $body .= "<p>-mixrevu team! </p> \r\n"; mail($to, $subject, $body, $headers); Quote Link to comment Share on other sites More sharing options...
mac_gyver Posted January 31, 2015 Share Posted January 31, 2015 you can run the code in a 'test' setting, where you comment out the mail() function call and echo the $body variable see how the html will be rendered in a browser. you can either make a corresponding 'test' form to submit to it the code or simply assign values to the $_POST variables that the code expects as input. Quote Link to comment Share on other sites More sharing options...
IvanTW Posted January 31, 2015 Author Share Posted January 31, 2015 mac_gyver, thanks for the response. I don't mean to sound slow, but where would I insert this? I am editing in Notepad++ and I have this: <?php echo $body = "<p><img src='http://www.mixrevu.com/img/logo.png'></p> \r\n"; $body .= "<p style='font-weight:bold;'>Welcome! We Absolutely Love New Members!</p> \r\n"; $body .= "<p style='font-weight:bold;'>Follow Us For Mixrevu.com Updates: <a href='https://www.facebook.com/mixrevu'> <img border='0' alt='Facebook page' src='http://www.mixrevu.com/images/Facebook-logo-300x300.jpg' width='45' height='45'> </a> <a href='https://www.twitter.com/MIXREVU'> <img border='0' alt='Twitter page' src='http://www.mixrevu.com/images/Twitter_logo_blue.png' width='45' height='35'> </a> <a href='https://plus.google.com/+Mixrevu'> <img border='0' alt='Google plus' src='http://www.mixrevu.com/images/google_plus_03.png' width='60' height='45'> </a></p> \r\n"; $body .= "<p>Your signup is now complete.</p> \r\n"; $body .= "<p>Your Login details are:<br> \r\n"; $body .= "Current Email: ".$_POST["email"]."<br> \r\n"; $body .= "Password: ".$_POST["pwd"]."</p> \r\n"; $body .= "<p style='font-weight:bold;'>Hang on to this email just in case you forget those details. </p> \r\n"; $body .= "<p>If you need any assistance, don’t worry we are here to HELP! - support@mixrevu.com</p> \r\n"; $body .= "<p style='font-weight:bold;'>Start Here</p> \r\n"; $body .= "<p>#1 Complete your profile by registering in the <a href='http://goo.gl/d2gBZX'>Forum</a>. This is where you’ll have access to our downloads when we upload them. Only members who’ve logged in to both will have access. You can also find previous Head2Head downloads <a href='http://goo.gl/L8gwXP'>HERE</a> that you can use for practice.<br> \r\n"; $body .= "#2 Be sure to check out the Mixrevu <a href='http://goo.gl/AUvo87'>Head2Head Rules</a>.<br> \r\n"; $body .= "#3 Mixrevu Head2Head Free Downloads are announced via Newsletters to all members first. You’ll automatically receive those as a site member. **If you have music of your own you want in a Head2Head, upload that too!!! We have genre specific spaces available.** <a href='http://goo.gl/FqzG6o'>Here’s how to upload</a>.<br> \r\n"; $body .= "#4 Our Sites Best <a href='http://goo.gl/5L8lzM'>Trivia</a>, <a href='http://goo.gl/yShmdh'>Quizzes</a> & <a href='http://goo.gl/smfV8z'>Audio Articles</a> are in our <a href='http://goo.gl/4Nmfqn'>Audio Blog</a>. - Exclusive content guaranteed to improve your mix process.<br> \r\n"; $body .= "#5 Upload your photo to our <a href='http://goo.gl/DOMMbP'>photo wall</a>, If you win a Head2Head this will be your featured photo!<br> \r\n"; $body .= "#6 Ever wanted to understand your studio better? We cover everything from EQ, Compression, Monitors, TDR, to Studio Acoustics & More in the <a href='http://goo.gl/KjCYxn'>Signal Path Series</a> .<br> \r\n"; $body .= "#7 <a href='http://goo.gl/kxQOik'>Exclusive Audio Engineer T-Shirts</a> & <a href='http://goo.gl/6KC31j'>Exclusive Downloads</a> you won’t find anywhere else are in our shop! Everything is ON SALE & Free Shipping in the U.S.!</p><br> \r\n"; $body .= "<p>-mixrevu team! </p> \r\n"; ?> When I try to Run in Chrome, it says Webpage not available. Do I have the call and echo placed correctly? For assigning variables to the $Post values, do I need to do this to see how my $body of my email will look? If I do, can I just insert ($_POST['email'] = 'TEXT HERE' to make the page work? I just want to see how this page/email will look to make sure it works once it's sent out. Thanks for the help and my basic questions. When I try to run it as an html page I just go to Run > run in chrome to see the actual page. Is this the correct way to see he body of the email? Thanks again. -ivan Quote Link to comment Share on other sites More sharing options...
mac_gyver Posted February 1, 2015 Share Posted February 1, 2015 php is a web server-side scripting language. the php code gets parsed, tokenized (converted to tokens/bytecode), and then interpreted by the php language engine on the web server when the .php page gets requested by the browser. you would enter the url of the web page in your browser's address bar. opening/running the file directly in your browser would just show the raw php code that's in the file. if you are editing this on your local computer and want to run it locally, you would either need to have a web server installed (there are all in one LAMP/WAMP - Lunix/Windows Apache, Mysql, Php packages) or in a pinch, you can use php's built in web server - http://php.net/manual/en/features.commandline.webserver.php you can also put the code into it's own .php file on the live web server where your site is hosted at and run it there. you don't need to set the $_POST variables. there will just be empty values where they are used, but you may get php errors in their place, depending on the php error reporting settings. Quote Link to comment Share on other sites More sharing options...
IvanTW Posted February 3, 2015 Author Share Posted February 3, 2015 mac_gyver Thanks a bunch! I went the "save as new php file and upload to my current website server" route and I'm able to preview everything once I type the address into a browser! Thanks a bunch! I'm glad I came here for help! I can see everything, make edits, re-upload and check what I need, AWESOME!! Thanks again. -ivan Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.