runff 1.0 commit

This commit is contained in:
rock64
2019-04-29 16:09:00 +02:00
commit f1567f989b
1268 changed files with 98652 additions and 0 deletions

87
lib/sns.php Normal file
View File

@@ -0,0 +1,87 @@
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
* Description of sns
*
* @author corradomulas
*/
require_once "Mail.php";
require 'aws/aws-autoloader.php';
use Aws\Sns\SnsClient;
use Aws\Exception\AwsException;
class snsrun {
//put your code here
public function sendEmail($to, $sub, $msg, $from)
{
// Pear Mail Library
$subject = 'Insert subject here'; // subject of mail
$headers = array(
'From' => $from,
'To' => $to,
'Subject' => $sub,
'Reply-To' => $from,
'X-Mailer' => "CM TLC",
);
$smtp = Mail::factory('smtp', array(
'host' => 'ssl://smtphost',
'port' => '465',
'auth' => true,
'username' => '', //your gmail account
'password' => '' // your password
));
// Send the mail
$mail = $smtp->send($to, $headers, $msg);
//check mail sent or not
if (PEAR::isError($mail)) {
return 0;
} else {
return 1;
}
}
public function sendSMS($num, $msg)
{
// Hard-coded credentials
$SnSclient = new SnsClient([
'version' => 'latest',
'region' => 'eu-west-1',
'credentials' => [
'key' => '',
'secret' => '',
],
]);
//$topic = 'arn:aws:sns:us-east-1:111122223333:MyTopic';
try {
$result = $SnSclient->publish([
"MessageAttributes" => [
'AWS.SNS.SMS.SenderID' => [
'DataType' => 'String',
'StringValue' => 'RUNIdP'
],
'AWS.SNS.SMS.SMSType' => [
'DataType' => 'String',
'StringValue' => 'Transactional'
]
],
'Message' => $msg,
'PhoneNumber' => $num,
]);
var_dump($result);
} catch (AwsException $e) {
// output error message if fails
error_log($e->getMessage());
}
}
}