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:
@@ -899,6 +899,7 @@ class wsBase
|
||||
* @param $aAttachment = null
|
||||
* @param boolean $showMessage = true
|
||||
* @param int $delIndex = 0
|
||||
* @param $config = null
|
||||
* @return $result will return an object
|
||||
*/
|
||||
public function sendMessage(
|
||||
@@ -912,7 +913,8 @@ class wsBase
|
||||
$appFields = null,
|
||||
$aAttachment = null,
|
||||
$showMessage = true,
|
||||
$delIndex = 0
|
||||
$delIndex = 0,
|
||||
$config = null
|
||||
) {
|
||||
try {
|
||||
if (!class_exists('System')) {
|
||||
@@ -920,6 +922,30 @@ class wsBase
|
||||
}
|
||||
$aSetup = System::getEmailConfiguration();
|
||||
|
||||
if($config != null){
|
||||
if(isset($config['EmailEngine']) && $config['EmailEngine'] != ""){
|
||||
$aSetup['MESS_ENGINE'] = $config['EmailEngine']; //EmailEngine
|
||||
}
|
||||
if(isset($config['Server']) && $config['Server'] != ""){
|
||||
$aSetup['MESS_SERVER'] = $config['Server']; //Server
|
||||
}
|
||||
if(isset($config['Port']) && $config['Port'] != ""){
|
||||
$aSetup['MESS_PORT'] = $config['Port']; //port
|
||||
}
|
||||
if(isset($config['UserName']) && $config['UserName'] != ""){
|
||||
$aSetup['MESS_ACCOUNT'] = $config['UserName']; //userName
|
||||
}
|
||||
if(isset($config['FromEmail']) && $config['FromEmail'] != ""){
|
||||
$aSetup['MESS_FROM_MAIL'] = $config['FromEmail']; //fromEmail
|
||||
}
|
||||
if(isset($config['UserPassword']) && $config['UserPassword'] != ""){
|
||||
$aSetup['MESS_PASSWORD'] = $config['UserPassword']; //userPassword
|
||||
}
|
||||
if(isset($config['SecureConnection']) && $config['SecureConnection'] != ""){
|
||||
$aSetup['SMTPSecure'] = $config['SecureConnection']; //secureConnection
|
||||
}
|
||||
}
|
||||
|
||||
$oSpool = new spoolRun();
|
||||
|
||||
$oSpool->setConfig($aSetup);
|
||||
|
||||
Reference in New Issue
Block a user