Jump to content

error


Glenskie

Recommended Posts

ok well the email sends but the php values wont show , they just show the actual php code.

<?php
include('Mail.php');
        include('Mail/mime.php');

        // Constructing the email
        $sender = "activate.social@gmail.com";                                            // Your email address
        $recipient = "$email1";                               // The Recipients name and email address
        $subject = "complete your registration";                                                // Subject for the email
        $text = 'This is a text message.';                                      // Text version of the email
        $html = '<html><body>Hi $username,

   Complete this step to activate your login identity at social

   Click the line below to activate when ready

   <a href="http://99.66.134.168/webinter/activation.php?id=$id&sequence=$db_password">Click here to activate your account</a>
   If the URL above is not an active link, please copy and paste it into your browser address bar

   Login after successful activation using your:  
   E-mail Address: $email1 
   Password: $pass1

   See you on the site!</body></html>';      // HTML version of the email
        $crlf = "\n";
        $headers = array(
                        'From'          => $sender,
                        'Return-Path'   => $sender,
                        'Subject'       => $subject
                        );

        // Creating the Mime message
        $mime = new Mail_mime($crlf);

        // Setting the body of the email
        $mime->setTXTBody($text);
        $mime->setHTMLBody($html);

        // Add an attachment
        

        // Set body and headers ready for base mail class
        $body = $mime->get();
        $headers = $mime->headers($headers);

        // SMTP authentication params
        $smtp_params["host"]     = "smtp.gmail.com";
        $smtp_params["port"]     = "587";
        $smtp_params["auth"]     = true;
        $smtp_params["username"] = "activate.social@gmail.com";
        $smtp_params["password"] = "pass";

        // Sending the email using smtp
        $mail =& Mail::factory("smtp", $smtp_params);
        $result = $mail->send($recipient, $headers, $body);
?>

Link to comment
Share on other sites

use double quotes:

$html = "<html><body>Hi $username,

   Complete this step to activate your login identity at social

   Click the line below to activate when ready

   <a href=\"http://99.66.134.168/webinter/activation.php?id=$id&sequence=$db_password\">Click here to activate your account</a>
   If the URL above is not an active link, please copy and paste it into your browser address bar

   Login after successful activation using your:  
   E-mail Address: $email1 
   Password: $pass1

   See you on the site!</body></html>";

That way the variables are parsed. Also you then have to escape the double quotes within the string, like where your hyperlink is.

Link to comment
Share on other sites

If you are curious as to why your version didn't work, check out this manual page: http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.double

 

In short, double quotes "interpolate" the inner string, which means instead of the literal string, you get the string with any variables replaced by their values

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.