Lib_Test_Enterprise_SendEmailWithAttachTest

The Gravity Forms Salesforce Add-On Lib Test Enterprise SendEmailWithAttachTest class.

Defined (1)

The class is defined in the following location(s).

/lib/Force.com-Toolkit-for-PHP/unit_test/Lib/Test/Enterprise/SendEmailWithAttachTest.php  
  1. class Lib_Test_Enterprise_SendEmailWithAttachTest extends Lib_Test_TestAbstractEnterprise 
  2. public function getTestName() 
  3. return 'SendEmailWithAttach'; 
  4.  
  5. protected function _run() 
  6. $EMAILID = 'hunter@barefootsolutions.com'; 
  7.  
  8. $singleEmail1 = new SingleEmailMessage(); 
  9. $singleEmail1->toAddresses = $EMAILID; 
  10. $singleEmail1->plainTextBody = "Hello there"; 
  11. $singleEmail1->subject = "First Single Email"; 
  12. $singleEmail1->saveAsActivity = true; 
  13. $singleEmail1->emailPriority = EMAIL_PRIORITY_LOW; 
  14. // $singleEmail1->inReplyTo = "First Single Email"; 
  15.  
  16. $filename = $this->_soapDir . '/earth.png'; 
  17. $handle = fopen($filename, "rb"); 
  18. $contents = fread($handle, filesize($filename)); 
  19. fclose($handle); 
  20. $attachment = new stdclass(); 
  21. $attachment->body = $contents; 
  22. $attachment->contentType = 'image/png'; 
  23. $attachment->fileName = $filename; 
  24. $attachment->inline = TRUE; 
  25.  
  26. $singleEmail1->setFileAttachments(array($attachment)); 
  27.  
  28. echo "***** Send Emails *****\n"; 
  29. $emailResponse = $this->_mySforceConnection->sendSingleEmail(array($singleEmail1)); 
  30.  
  31. print_r($emailResponse);