PM-246 New parameter Alternative Email Settings in PMFSendMessage

A new parameter $config (associative array) was added in the PMFSendMessage function:

Example 1:

array(
"EmailEngine"=>"PHPMAILER",
"Server"=>"smtp.gmail.com",
"Port"=>587,
"UserName"=>"jennylee@colosa.com",
"FromEmail"=>"jennylee@colosa.com",
"UserPassword"=>"asfasjeasas",
"SecureConnection"=>"tls"
)

The parameters of the $config array showed in the example 1 are all the parameters that the array $config accepts, this could just have the UserName and the UserPassword if all the other parameters are the same as those that are configured in System configuration.

Example 2:
array(
"UserName"=>"jennylee@colosa.com",
"UserPassword"=>"asfasjeasas"
)
This commit is contained in:
jennylee
2014-09-18 13:42:34 -04:00
parent 5512f19413
commit 55327ad543
2 changed files with 33 additions and 3 deletions

View File

@@ -831,6 +831,7 @@ function getEmailConfiguration ()
* @param array | $aAttachment = array() | Attachment | An Optional arrray. An array of files (full paths) to be attached to the email.
* @param boolean | $showMessage = true | Show message | Optional parameter.
* @param int | $delIndex = 0 | Delegation index of the case | Optional parameter. The delegation index of the current task in the case.
* @param array | $config = array() | Alternative Email Settings | An optional array: An array of parameters to be used in the Email sent (EmailEngine, Server, Port, FromEmail, Username, UserPassword, and SecureConnection).
* @return int | | result | Result of sending email
*
*/
@@ -846,7 +847,8 @@ function PMFSendMessage(
$aFields = array(),
$aAttachment = array(),
$showMessage = true,
$delIndex = 0
$delIndex = 0,
$config = array()
) {
ini_set ( "pcre.backtrack_limit", 1000000 );
ini_set ( 'memory_limit', '-1' );
@@ -876,12 +878,14 @@ function PMFSendMessage(
$aFields,
$aAttachment,
$showMessage,
$delIndex
$delIndex,
$config
);
if ($result->status_code == 0) {
return 1;
} else {
error_log($result->message);
return 0;
}
}