Location: PHPKode > projects > pMH > pmh/src/user/actSendCode.php
<?php
/*

$Header: /cvs/hol/src/user/actSendCode.php,v 1.3 2005/03/17 18:26:29 jakuza Exp $

<fusedoc fuse="actSendCode.php">

   <responsibilities>
      Send an activation code to the declared user mail

   </responsibilities>

   <properties>
      <history author="" date="2003 September 29" email="" type="create" />

      <note>
         Data Rules: registrationData - (None)
         Data Rules: confirmationCode - MD5 hash;
      </note>
   </properties>

   <io>
      <in>
         <string name="self" optional="false" />
         <structure name="registrationData" scope="request" optional="false" comment="User registration data form fields" />
         <string name="confirmationCode" scope="request" optional="false" comment="" />
      </in>
      <out>
      </out>
      <passthrough>
      </passthrough>
		
   </io>

</fusedoc>
*/

$mail = new PHPMailer();

switch ($GLOBALS['CONFIG']['MAILMETHOD']) {
	case SMTP:
		$mail->IsSMTP(); # telling the class to use SMTP
		$mail->Host = $GLOBALS['CONFIG']['SMTP'];
		break;
	case PHPMAIL:
	default:
		$mail->IsMail(); # telling the class to use PHP mail() function
}

$mail->From = $GLOBALS['CONFIG']['MAILFROM'];
$mail->FromName = $GLOBALS['CONFIG']['APPNAME'];
$mail->AddAddress($_SESSION['regData']['email']);

# Build account activation URL
$url = 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'].'?fuseaction='.$XFA[XFA_Activate].'&code='.$record['confirmcode'].'&username='.$record['username'].'&returnFuseaction='.$_SESSION['regData']['returnfa'];

$mail->Subject = $GLOBALS['language']['user']['codemailsubject'];
$mail->Body = sprintf($GLOBALS['language']['user']['codemail'], $_SESSION['regData']['firstname'], $url);
$mail->WordWrap = WRAP;

$fuseFailure = !$mail->Send();

if ($fuseFailure) die('Activation mail error');

# destroy data in session if it's all OK
if (!$_SESSION['regData']['returnFuseaction'])
	unset($_SESSION['regData']);

?>
Return current item: pMH