Exemplo n.º 1
0
<?php

require_once "vendor/autoload.php";
use garethp\ews\API\Type;
$api = MailApi::withUsernameAndPassword('server', 'username', 'password');
//Create the message item
$message = new Type\MessageType();
$message->setSubject('Test Message');
$message->setBody('Test Draft Body');
//Set the message as not a draft using extended property types
$extended = new Type\ExtendedPropertyType();
$fieldUri = new Type\ExtendedFieldURI();
$fieldUri->setPropertyTag("0x0E07");
$fieldUri->setPropertyType(\garethp\ews\API\Enumeration\MapiPropertyTypeType::INTEGER);
$extended->setExtendedFieldURI($fieldUri);
$extended->setValue(1);
$message->addExtendedProperty($extended);
//Pass it to the Send Mail function, but to SaveOnly without actually sending the email
$itemId = $api->sendMail($message, array('MessageDisposition' => 'SaveOnly'));
//Move the mail message from the sent folder to whatever folder we want to send it to
$api->getClient()->MoveItem(Type::buildFromArray(array('ToFolderId' => array('FolderId' => $folderId->toArray()), 'ItemIds' => array('ItemId' => $itemId->toArray()))));
	public function actionBackground($result,$msg)
	{
		//$count = count($info_id);

		Yii::import('application.extensions.runactions.components.ERunActions');
			
		require_once "Mail.php";

		if (ERunActions::runBackground())
		{
		
			for($i=0;$i<$count;$i++)
			{
				$mailobj=new MailApi;
				$to = $result;
				
				$mailobj->sendmail($to,$msg);
			}
		}
		else
		{
			$this->redirect(array('admin'));
		}
	}
Exemplo n.º 3
0
 public function actionForgotpassword()
 {
     $this->layout = 'loginLayout';
     $model = new LoginForm();
     if (isset($_POST['LoginForm'])) {
         $model->attributes = $_POST['LoginForm'];
         $user_id = User::model()->findByAttributes(array('user_organization_email_id' => $_POST['LoginForm']['username']));
         if (!empty($user_id)) {
             $random = substr(number_format(time() * rand(), 0, '', ''), 0, 10);
             $mail = '';
             $check_user = StudentTransaction::model()->find('student_transaction_user_id =' . $user_id->user_id);
             if (!empty($check_user)) {
                 $mail = StudentInfo::model()->findByPk($check_user->student_transaction_student_id)->student_email_id_1;
             }
             $check_user_emp = EmployeeTransaction::model()->find('employee_transaction_user_id =' . $user_id->user_id);
             if (!empty($check_user_emp)) {
                 $mail = EmployeeInfo::model()->findByPk($check_user_emp->employee_transaction_employee_id)->employee_private_email;
             }
             if ($mail != '') {
                 $mailobj = new MailApi();
                 $r = $mailobj->sendmail($mail, $random);
                 $update_user = User::model()->findByPk($user_id->user_id);
                 $update_user->user_password = md5($random . $random);
                 $update_user->save();
                 $this->redirect(array('smsNotification', 'status' => 'success'));
             }
         } else {
             $this->redirect(array('smsNotification', 'status' => 'user_not_exist'));
         }
     }
     $this->render('forgotpassword', array('model' => $model));
 }