[go: up one dir, main page]

Menu

[3822d7]: / tests / email.php  Maximize  Restore  History

Download this file

44 lines (36 with data), 1.5 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
/* * ***************************************************************
* Copyright © 2014 ICT Innovations Pakistan All Rights Reserved *
* Developed By: Nasir Iqbal *
* Website : http://www.ictinnovations.com/ *
* Mail : nasir@ictinnovations.com *
* *************************************************************** */
use ICT\Core\Core;
use ICT\Core\Gateway\Sendmail;
use ICT\Core\Request;
// remove sendmail and bin parent by .. / ..
chdir(dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'core');
include_once "Core.php";
$source_pdf = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'data' . DIRECTORY_SEPARATOR . 'fax.pdf';
$test_pdf = '/tmp/fax_test.pdf';
copy($source_pdf, $test_pdf);
process_email('nasir@ictinnovations.com', '12132942943@localhost', 'test fax', 'empty', 'empty', $test_pdf);
function process_email($from, $to, $subject, $body, $body_alt = '', $attachment = '')
{
$oRequest = new Request();
$oRequest->gateway_flag = Sendmail::GATEWAY_FLAG;
$oRequest->destination = $to;
$oRequest->source = $from;
$oRequest->context = 'internal'; // TODO replace context with domain
$oRequest->application_id = 'email_receive';
$oRequest->application_data = array(
'subject' => $subject,
'body' => $body,
'body_alt' => $body_alt,
'attachment' => $attachment,
'status' => 'completed',
'response' => '',
'result' => 'success'
);
Core::process($oRequest);
}