BUG 8438 8341 " $from parameter for the PMFSendMessage() function .." SOLVED

- Now the user can set from account for PMFSendMessage() function.
This commit is contained in:
Erik Amaru Ortiz
2012-02-14 10:32:48 -04:00
parent befd02ac54
commit ec9875d537
6 changed files with 87 additions and 69 deletions

View File

@@ -81,8 +81,8 @@ class spoolRun {
$this->ExceptionCode['WARNING'] = 2;
$this->ExceptionCode['NOTICE'] = 3;
$this->longMailEreg = '/([\"\w\W\s]*\s*)?(<([\w\-\.]+@[\.-\w]+\.\w{2,3})+>)/';
$this->mailEreg = '/^([\w\-_\.]+@[\.-\w]+\.\w{2,3}+)$/';
$this->longMailEreg = '/(.*)(<([\w\-\.]+@[\w\-_\.]+\.\w{2,3})+>)/';
$this->mailEreg = '/^([\w\-_\.]+@[\w\-_\.]+\.\w{2,3}+)$/';
}
/**
@@ -220,8 +220,9 @@ class spoolRun {
if( isset($matches[1]) && $matches[1] != '' ) {
//drop the " characters if they exist
$this->fileData['from_name'] = trim(str_replace('"', '', $matches[1]));
} else { //if the from name was not set
$this->fileData['from_name'] = 'Processmaker';
}
else { //if the from name was not set
$this->fileData['from_name'] = '';
}
if( ! isset($matches[3]) ) {
@@ -229,7 +230,8 @@ class spoolRun {
}
$this->fileData['from_email'] = trim($matches[3]);
} else {
}
else {
//to validate simple email address i.e. erik@colosa.com
preg_match($this->mailEreg, $this->fileData['from'], $matches);
@@ -237,7 +239,7 @@ class spoolRun {
throw new Exception('Invalid email address in FROM parameter (' . $this->fileData['from'] . ')', $this->ExceptionCode['WARNING']);
}
$this->fileData['from_name'] = 'Processmaker Web boot';
$this->fileData['from_name'] = '';
$this->fileData['from_email'] = $matches[0];
}
@@ -327,10 +329,10 @@ class spoolRun {
$oPHPMailer->Host = $this->config['MESS_SERVER'];
$oPHPMailer->Port = $this->config['MESS_PORT'];
$oPHPMailer->Username = $this->config['MESS_ACCOUNT'];
$passwd = $this->config['MESS_PASSWORD'];
if(strpos( $passwd, 'hush:' ) !== false){
list($hush, $pass) = explode(":", $passwd);
$this->config['MESS_PASSWORD'] = G::decrypt($pass,'EMAILENCRYPT');
$passwd = $this->config['MESS_PASSWORD'];
if(strpos( $passwd, 'hush:' ) !== false){
list($hush, $pass) = explode(":", $passwd);
$this->config['MESS_PASSWORD'] = G::decrypt($pass,'EMAILENCRYPT');
}
$oPHPMailer->Password = $this->config['MESS_PASSWORD'];
$oPHPMailer->From = $this->fileData['from_email'];
@@ -380,10 +382,10 @@ class spoolRun {
$oPHPMailer->Host = $this->config['MESS_SERVER'];
$oPHPMailer->Port = $this->config['MESS_PORT'];
$oPHPMailer->Username = $this->config['MESS_ACCOUNT'];
$passwd = $this->config['MESS_PASSWORD'];
if(strpos( $passwd, 'hush:' ) !== false){
list($hush, $pass) = explode(":", $passwd);
$this->config['MESS_PASSWORD'] = G::decrypt($pass,'EMAILENCRYPT');
$passwd = $this->config['MESS_PASSWORD'];
if(strpos( $passwd, 'hush:' ) !== false){
list($hush, $pass) = explode(":", $passwd);
$this->config['MESS_PASSWORD'] = G::decrypt($pass,'EMAILENCRYPT');
}
$oPHPMailer->Password = $this->config['MESS_PASSWORD'];
$oPHPMailer->From = $this->fileData['from_email'];
@@ -465,10 +467,10 @@ class spoolRun {
$send->setPort($this->config['MESS_PORT']);
$send->setUsername($this->config['MESS_ACCOUNT']);
$passwd = $this->config['MESS_PASSWORD'];
if(strpos( $passwd, 'hush:' ) !== false){
list($hush, $pass) = explode(":", $passwd);
$this->config['MESS_PASSWORD'] = G::decrypt($pass,'EMAILENCRYPT');
$passwd = $this->config['MESS_PASSWORD'];
if(strpos( $passwd, 'hush:' ) !== false){
list($hush, $pass) = explode(":", $passwd);
$this->config['MESS_PASSWORD'] = G::decrypt($pass,'EMAILENCRYPT');
}
$send->setPassword($this->config['MESS_PASSWORD']);
$send->setReturnPath($this->fileData['from_email']);
@@ -498,10 +500,10 @@ class spoolRun {
$oConfiguration = new Configuration();
$aConfiguration = $oConfiguration->load('Emails', '', '', '', '');
$aConfiguration = unserialize($aConfiguration['CFG_VALUE']);
$passwd = $aConfiguration['MESS_PASSWORD'];
if(strpos( $passwd, 'hush:' ) !== false){
list($hush, $pass) = explode(":", $passwd);
$aConfiguration['MESS_PASSWORD'] = G::decrypt($pass,'EMAILENCRYPT');
$passwd = $aConfiguration['MESS_PASSWORD'];
if(strpos( $passwd, 'hush:' ) !== false){
list($hush, $pass) = explode(":", $passwd);
$aConfiguration['MESS_PASSWORD'] = G::decrypt($pass,'EMAILENCRYPT');
}
if( $aConfiguration['MESS_ENABLED'] == '1' ) {
$this->setConfig(array (