Example using PHPMAILER.
Download PHPMAILER from :
https://github.com/PHPMailer/PHPMailerand extract to root directory of your web app
//include
require 'PHPMailerAutoload.php';
//Create a new PHPMailer instance
$mail = new PHPMailer;
//Tell PHPMailer to use SMTP
$mail->isSMTP();
//Enable SMTP debugging
// 0 = off (for production use)
// 1 = client messages
// 2 = client and server messages
$mail->SMTPDebug = 0;
//Ask for HTML-friendly debug output
//$mail->Debugoutput = 'html';
$mail->IsHTML(true);
//Set the hostname of the mail server
$mail->Host = 'yourdomain.com';
//Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission
$mail->Port = 25;
//Set the encryption system to use - ssl (deprecated) or tls
//$mail->SMTPSecure = 'tls';
//Whether to use SMTP authentication
$mail->SMTPAuth = true;
//Username to use for SMTP authentication - use full email address for gmail
$mail->Username = "userneme@yourdomain.com";
//Password to use for SMTP authentication
$mail->Password = "your_smtp_password";
//Set who the message is to be sent from
$mail->setFrom('userneme@yourdomain.com', 'John Doe');
//Set an alternative reply-to address
$mail->addReplyTo('userneme2@yourdomain.com', 'Bill Gates');
//Set who the message is to be sent to
$mail->addAddress($userdata["email"]);
$mail->addCC("anyaddress@gmail.com");
//Set the subject line
$mail->Subject = 'Halo, your message subject here';
$mail->Body = "Body of your message here";
►► It is specific about sending an email after successful registration:
Description
Occurs when new user registered successfully
Parameters
$userdata - an array with the user-entered data. Access fields by
$userdata["FieldName"].
"dict" is an alternate name for this parameter.
$pageObject - an object of Page class representing the current page
► The following comes up after adding the code:
// ** Send simple email ****
$email="test@test.com";
$from="admin@test.com";
$msg="Hello there\nBest regards";
$subject="Sample subject";
$attachments = array();
// Attachments description. The 'path' is required. Others parameters are optional.
// $attachments = array(
// array('path' => getabspath('files/1.jpg')),
// array('path' => getabspath('files/2.jpg'), 'name' => 'image.jpg', 'encoding' => 'base64', 'type' => 'application/octet-stream')) ;
$ret=runner_mail(array('to' => $email, 'subject' => $subject, 'body' => $msg, 'from'=>$from, 'attachments' => $attachments));
// You can manually overwrite SMTP settings
// $ret=runner_mail(array('to' => $email, 'subject' => $subject, 'body' => $msg, 'from'=>$from, 'attachments' => $attachments,
// 'host' => 'somehost', 'port' => 25, 'username' => 'smtpUserName', 'password' => 'password'));
if(!$ret["mailed"])
echo $ret["message"];
This not functioning. It is however functioning at whatever page but not @ AfterSuccessfulRegistration.
So, I think I should do something with the parameters?:
Parameters
$userdata - an array with the user-entered data. Access fields by
$userdata["FieldName"].
"dict" is an alternate name for this parameter.
$pageObject - an object of Page class representing the current page
I hope it is clear. Thanks again?