Total Complexity | 2 |
Total Lines | 35 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
2 | class Lib_Test_Enterprise_SendEmailWithAttachTest extends Lib_Test_TestAbstractEnterprise |
||
3 | { |
||
4 | public function getTestName() |
||
5 | { |
||
6 | return 'SendEmailWithAttach'; |
||
7 | } |
||
8 | |||
9 | protected function _run() |
||
10 | { |
||
11 | $EMAILID = '[email protected]'; |
||
12 | |||
13 | $singleEmail1 = new SingleEmailMessage(); |
||
14 | $singleEmail1->toAddresses = $EMAILID; |
||
15 | $singleEmail1->plainTextBody = "Hello there"; |
||
16 | $singleEmail1->subject = "First Single Email"; |
||
17 | $singleEmail1->saveAsActivity = true; |
||
18 | $singleEmail1->emailPriority = EMAIL_PRIORITY_LOW; |
||
19 | // $singleEmail1->inReplyTo = "First Single Email"; |
||
20 | |||
21 | $filename = $this->_soapDir . '/earth.png'; |
||
22 | $handle = fopen($filename, "rb"); |
||
23 | $contents = fread($handle, filesize($filename)); |
||
24 | fclose($handle); |
||
25 | $attachment = new stdclass(); |
||
26 | $attachment->body = $contents; |
||
27 | $attachment->contentType = 'image/png'; |
||
28 | $attachment->fileName = $filename; |
||
29 | $attachment->inline = TRUE; |
||
30 | |||
31 | $singleEmail1->setFileAttachments(array($attachment)); |
||
32 | |||
33 | echo "***** Send Emails *****\n"; |
||
34 | $emailResponse = $this->_mySforceConnection->sendSingleEmail(array($singleEmail1)); |
||
35 | |||
36 | print_r($emailResponse); |
||
37 | } |
||
38 | } |