示例#1
0
        function VoucherCreate($VoucherId)
        {

            $voucher = new voucher();
            $customer = new customer();
            $currency = new currency();

            $voucher->setVoucherId($VoucherId);
            $voucher->extractor($voucher->getVoucherById());

            $systemSetting = new systemSetting();
            $common = new common();
            $systemSetting->extractor($systemSetting->getSettings());

            $customer->setCustomerId($voucher->voucherCustomerId());
            $customer->extractor($customer->getCustomerById());
            $filename = $systemSetting->sySettingDocumentName() . 'voucher_' . $voucher->voucherId() . '.pdf';

            $subject = $systemSetting->sySettingCompanyName() . ' - New Discount Voucher received from ' . $voucher->voucherFromName() . '!!!';
            $EmailMessage = '<table width="785" border="0" cellpadding="20" cellspacing="0">
	  <tr>
	  <td width="-34" bgcolor="#333333" style="font-family:Arial, Helvetica, sans-serif; font-size:20px; color:#000; padding:4px 0 4px 5px;">&nbsp;</td>
	  <td width="699" align="left" bgcolor="#333333"><img src="' . DOC_ROOT . 'uplode-img/company-logo/' . $systemSetting->sySettingCompanyLogo() . '"  /></td>
	  </tr>
	  <tr>
	  <td colspan="2" bgcolor="#f0f0f0" style=" font-family:arial; font-size:13px;">
	  <br>
	  Dear <strong> Mr/Miss/Mrs&nbsp;' . $voucher->voucherToName() . '</strong>, <br/><br/>
	  We are pleased to inform you that <strong>' . $voucher->voucherFromName() . '</strong> has gifted you a voucher worth <strong>' . $currency->convetNumberFormatDefault($voucher->voucherAmount()) . ' </strong>.<br>
	  
	  Your Voucher Code ..<br/><br/>

	  <strong>#</strong> <span style="color:#F00"><strong> ' . $voucher->voucherCode() . '</strong> </span><br/>
	  <br/><br/>
	  br>
	  <p>
	 Thanking you for taking the time in shopping online with us.
  <br/>
	  ' . $systemSetting->sySettingCompanyName() . '<br/><br/>
	  
	  Best Regards,<br/>
	  Web Administrator<br/>
	  <strong>' . $systemSetting->sySettingCompanyName() . '  - on ' . date('Y-m-d h:i a') . '</strong><br/>
	  </p>
	  
	  
	  <hr/>
	  <span style="color:#666; font-size:11px; font-family:Arial, Helvetica, sans-serif;">You are receiving this email, because an account has been registered at the ' . $systemSetting->sySettingCompanyName() . ' Online Shoping cart  portal. If you have not made any registration or unaware of the same, please email administrator at ' . $systemSetting->sySettingCompanyEmail() . ' to remove you from this panel.</span>
	  </td>
	  </tr>
	  </table>
';
            $mail = new PHPMailer();
            $mail->IsSMTP();
            $mail->SMTPAuth = true; // enable SMTP authentication
            $mail->SMTPSecure = "ssl"; // sets the prefix to the servier
            $mail->Host = $systemSetting->sySettingHost(); // sets GMAIL as the SMTP server
            $mail->Port = $systemSetting->sySettingPort(); // set the SMTP port

            $mail->Username = $systemSetting->sySettingSmtpUsername(); // GMAIL username
            $mail->Password = $systemSetting->sySettingSmtpPassword(); // GMAIL password

            $mail->From = $systemSetting->sySettingSmtpUsername();
            $mail->FromName = $systemSetting->sySettingFromName();
            $mail->Subject = $subject;
            $mail->WordWrap = 50; // set word wrap

            $mail->MsgHTML($EmailMessage);
            $mail->AddAddress($voucher->voucherToEmail(), $systemSetting->sySettingCompanyName());
            $mail->AddCC($customer->customerEmail(), $systemSetting->sySettingCompanyName());
            $mail->IsHTML(true); // send as HTML

            $mail->Send();
            return true;

        }