Jump to content

php mailer


Alidad

Recommended Posts

hi, I'm trying to to solve problme with email conformation, they are two php files. The first file 'first.php' it come with registration forms and send data to mysql with conformatin number.

 

after that it will send email conformation to the person who sign up for activation that file is "process.php"

 

The first file to send data to mysql is works great.

 

I use this code from dreamweaver, as you can see it sending data to mysql

 

 

First.php

 

 

<?php require_once('../Connections/emailtest.php'); ?>

<?php

$confirm_code=md5(uniqid(rand())); 
// values sent from form 
$name=$_POST['name'];
$email=$_POST['email'];
$password=$_POST['password'];
$country=$_POST['country'];
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
  $insertSQL = sprintf("INSERT INTO temp_members_db (confirm_code, name, email, password, country) VALUES (%s, %s, %s, %s, %s)",
                       
				   GetSQLValueString("$confirm_code", "text"),
                       GetSQLValueString("$name", "text"),
                       GetSQLValueString("$email", "text"),
                       GetSQLValueString("$password", "text"),
                       GetSQLValueString("$country", "text"));

  mysql_select_db($database_emailtest, $emailtest);
  $Result1 = mysql_query($insertSQL, $emailtest) or die(mysql_error());

  $insertGoTo = "process.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $_SERVER['QUERY_STRING'];

  }
  
  header(sprintf("Location: %s", $insertGoTo));
}
?>

 

and then in process.php showing .... please see part where it said "$mail->AddAddress($_POST['email'];

 

<?php
require("PHPMailer/class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = "smtp.comcast.net"; // SMTP server
$mail->From = "root@root.com";
$mail->AddAddress($_POST['email'];
$mail->Subject = "your conformation";
$mail->Body="Your Comfirmation link \r\n";
$mail->Body="Click on this link to activate your account \r\n";
$mail->Body="http://localhost/ourdeafworld/EmailTest/confirmation.php?passkey=$confirm_code";
$mail->WordWrap = 50;



if(!$mail->Send())
{
   echo 'Message was not sent.';
   echo 'Mailer error: ' . $mail->ErrorInfo;
}
else
{
   echo 'Message has been sent.';
}
?> 

 

but is not sending email to the person who sign up for conformation. what did i missed in part of "$_POST['email'];"

 

please help me thanks.

 

AM

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.