Skip to content
Permalink
Browse files
sending account creation emails to the PIs
  • Loading branch information
scnakandala committed Oct 25, 2015
1 parent 63af3b5 commit f6af261ec1aeb723bb61b03509b222ee2c5bb233
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 2 deletions.
@@ -175,6 +175,26 @@ return array(
* Email address of the portal admin. Portal admin well get email notifications for events
* such as new user creation
*/
'admin-email' => 'abc@xyz.com'
'admin-emails' => ['xxx@xxx.com','yyy@yyy.com'],

/**
* Email account that the portal should login to send emails
*/
'portal-email-username' => 'xyz@abc.com',

/**
* Password for the portal's email account
*/
'portal-email-password' => 'xxxxxxxxxxx',

/**
* SMTP server on which the portal should connect
*/
'portal-smtp-server-host' => 'smtp.gmail.com',

/**
* SMTP server port on which the portal should connect
*/
'portal-smtp-server-port' => '587'
]
);
@@ -273,6 +273,7 @@ public function confirmAccountCreation()
try{
$result = WSIS::confirmUserRegistration($username, $confirmation, Config::get('pga_config.wsis')['tenant-domain']);
if($result){
$this->sendAccountCreationNotification2Admin($username);
return Redirect::to("login");
}else{
CommonUtilities::print_error_message("Account confirmation failed!");
@@ -285,6 +286,42 @@ public function confirmAccountCreation()
}
}

private function sendAccountCreationNotification2Admin($username){

$mail = new PHPMailer;

$mail->isSMTP();
$mail->SMTPDebug = 3;
$mail->Host = Config::get('pga_config.portal')['portal-smtp-server-host'];

$mail->SMTPAuth = true;

$mail->Username = Config::get('pga_config.portal')['portal-email-username'];
$mail->Password = Config::get('pga_config.portal')['portal-email-password'];

$mail->SMTPSecure = "tls";
$mail->Port = intval(Config::get('pga_config.portal')['portal-smtp-server-port']);

$mail->From = Config::get('pga_config.portal')['portal-email-username'];
$mail->FromName = "Airavata PHP Gateway";

$recipients = Config::get('pga_config.portal')['admin-emails'];
foreach($recipients as $recipient){
$mail->addAddress($recipient);
}

$mail->isHTML(true);

$mail->Subject = "New User Account Was Created Successfully";
$userProfile = WSIS::getUserProfile($username);
$str = "Username: " . $username . "@" . Config::get('pga_config.wsis')['tenant-domain'] . "<br/>";
$str = $str . "Name: " . $userProfile["firstname"] . " " . $userProfile["lastname"] . "<br/>";
$str = $str . "Email: " . $userProfile["email"];

$mail->Body = $str;
$mail->send();
}

public function resetPasswordSubmit()
{
$rules = array(
@@ -5,7 +5,8 @@
"license": "MIT",
"require": {
"laravel/framework": "4.2.*",
"teepluss/theme": "1.*@dev"
"teepluss/theme": "1.*@dev",
"phpmailer/phpmailer": "v5.2.13"
},
"autoload": {
"classmap": [

0 comments on commit f6af261

Please sign in to comment.