Merge branch 'develop' of ssh://git@github.com/Dolibarr/dolibarr.git into develop
This commit is contained in:
commit
e20818f9ed
@ -751,6 +751,7 @@ else
|
|||||||
$formmail->withcancel=1;
|
$formmail->withcancel=1;
|
||||||
$formmail->withdeliveryreceipt=1;
|
$formmail->withdeliveryreceipt=1;
|
||||||
$formmail->withfckeditor=1;
|
$formmail->withfckeditor=1;
|
||||||
|
$formmail->ckeditortoolbar='dolibarr_mailings';
|
||||||
// Tableau des substitutions
|
// Tableau des substitutions
|
||||||
$formmail->substit=$substitutionarrayfortest;
|
$formmail->substit=$substitutionarrayfortest;
|
||||||
// Tableau des parametres complementaires du post
|
// Tableau des parametres complementaires du post
|
||||||
|
|||||||
@ -773,12 +773,12 @@ else
|
|||||||
|
|
||||||
// From
|
// From
|
||||||
print '<tr><td>'.$form->editfieldkey("MailFrom",'email_from',$object->email_from,$object,$user->rights->mailing->creer && $object->statut < 3,'string').'</td><td colspan="3">';
|
print '<tr><td>'.$form->editfieldkey("MailFrom",'email_from',$object->email_from,$object,$user->rights->mailing->creer && $object->statut < 3,'string').'</td><td colspan="3">';
|
||||||
print $form->editfieldval("MailFrom",'email_from',$object->email_from,$object,$user->rights->mailing->creer && $object->statut < 3,'email');
|
print $form->editfieldval("MailFrom",'email_from',$object->email_from,$object,$user->rights->mailing->creer && $object->statut < 3,'string');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Errors to
|
// Errors to
|
||||||
print '<tr><td>'.$form->editfieldkey("MailErrorsTo",'email_errorsto',$object->email_errorsto,$object,$user->rights->mailing->creer && $object->statut < 3,'string').'</td><td colspan="3">';
|
print '<tr><td>'.$form->editfieldkey("MailErrorsTo",'email_errorsto',$object->email_errorsto,$object,$user->rights->mailing->creer && $object->statut < 3,'string').'</td><td colspan="3">';
|
||||||
print $form->editfieldval("MailErrorsTo",'email_errorsto',$object->email_errorsto,$object,$user->rights->mailing->creer && $object->statut < 3,'email');
|
print $form->editfieldval("MailErrorsTo",'email_errorsto',$object->email_errorsto,$object,$user->rights->mailing->creer && $object->statut < 3,'string');
|
||||||
print '</td></tr>';
|
print '</td></tr>';
|
||||||
|
|
||||||
// Status
|
// Status
|
||||||
|
|||||||
@ -664,17 +664,14 @@ class CMailFile
|
|||||||
|
|
||||||
$out='';
|
$out='';
|
||||||
|
|
||||||
|
$out.= "--" . $this->mixed_boundary . $this->eol;
|
||||||
|
|
||||||
if ($this->atleastoneimage)
|
if ($this->atleastoneimage)
|
||||||
{
|
{
|
||||||
$out.= "--" . $this->mixed_boundary . $this->eol;
|
|
||||||
$out.= "Content-Type: multipart/alternative; boundary=\"".$this->alternative_boundary."\"".$this->eol;
|
$out.= "Content-Type: multipart/alternative; boundary=\"".$this->alternative_boundary."\"".$this->eol;
|
||||||
$out.= $this->eol;
|
$out.= $this->eol;
|
||||||
$out.= "--" . $this->alternative_boundary . $this->eol;
|
$out.= "--" . $this->alternative_boundary . $this->eol;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
$out.= "--" . $this->mixed_boundary . $this->eol;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->msgishtml)
|
if ($this->msgishtml)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -597,6 +597,8 @@ class FormMail
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (! isset($this->ckeditortoolbar)) $this->ckeditortoolbar = 'dolibarr_notes';
|
||||||
|
|
||||||
if(! empty($conf->global->MAIL_USE_SIGN) && $this->fromid > 0)
|
if(! empty($conf->global->MAIL_USE_SIGN) && $this->fromid > 0)
|
||||||
{
|
{
|
||||||
$fuser=new User($this->db);
|
$fuser=new User($this->db);
|
||||||
@ -609,7 +611,7 @@ class FormMail
|
|||||||
|
|
||||||
// Editor wysiwyg
|
// Editor wysiwyg
|
||||||
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/core/class/doleditor.class.php");
|
||||||
$doleditor=new DolEditor('message',$defaultmessage,'',280,'dolibarr_notes','In',true,false,$this->withfckeditor,8,72);
|
$doleditor=new DolEditor('message',$defaultmessage,'',280,$this->ckeditortoolbar,'In',true,true,$this->withfckeditor,8,72);
|
||||||
$out.= $doleditor->Create(1);
|
$out.= $doleditor->Create(1);
|
||||||
}
|
}
|
||||||
$out.= "</td></tr>\n";
|
$out.= "</td></tr>\n";
|
||||||
|
|||||||
@ -165,6 +165,16 @@ class SMTPs
|
|||||||
*/
|
*/
|
||||||
var $_smtpsBoundary = null;
|
var $_smtpsBoundary = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Related Boundary
|
||||||
|
*/
|
||||||
|
var $_smtpsRelatedBoundary = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Alternative Boundary
|
||||||
|
*/
|
||||||
|
var $_smtpsAlternativeBoundary = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determines the method inwhich the message are to be sent.
|
* Determines the method inwhich the message are to be sent.
|
||||||
* - 'sockets' [0] - conect via network to SMTP server - default
|
* - 'sockets' [0] - conect via network to SMTP server - default
|
||||||
@ -1202,13 +1212,22 @@ class SMTPs
|
|||||||
* TODO Investigate "nested" boundary message parts
|
* TODO Investigate "nested" boundary message parts
|
||||||
*/
|
*/
|
||||||
//$content = 'Content-Type: multipart/related; boundary="' . $this->_getBoundary() . '"' . "\r\n";
|
//$content = 'Content-Type: multipart/related; boundary="' . $this->_getBoundary() . '"' . "\r\n";
|
||||||
$content = 'Content-Type: multipart/mixed; boundary="' . $this->_getBoundary() . '"' . "\r\n";
|
$content = 'Content-Type: multipart/mixed; boundary="' . $this->_getBoundary('mixed') . '"' . "\r\n";
|
||||||
|
|
||||||
// . "\r\n"
|
// . "\r\n"
|
||||||
// . 'This is a multi-part message in MIME format.' . "\r\n";
|
// . 'This is a multi-part message in MIME format.' . "\r\n";
|
||||||
$content .= "Content-Transfer-Encoding: 8bit\r\n";
|
$content .= "Content-Transfer-Encoding: 8bit\r\n";
|
||||||
$content .= "\r\n";
|
$content .= "\r\n";
|
||||||
|
|
||||||
|
$content .= "--" . $this->_getBoundary('mixed') . "\r\n";
|
||||||
|
|
||||||
|
if (key_exists('image', $this->_msgContent))
|
||||||
|
{
|
||||||
|
$content.= 'Content-Type: multipart/alternative; boundary="'.$this->_getBoundary('alternative').'"' . "\r\n";
|
||||||
|
$content .= "\r\n";
|
||||||
|
$content .= "--" . $this->_getBoundary('alternative') . "\r\n";
|
||||||
|
}
|
||||||
|
|
||||||
// Loop through message content array
|
// Loop through message content array
|
||||||
foreach ($this->_msgContent as $type => $_content )
|
foreach ($this->_msgContent as $type => $_content )
|
||||||
{
|
{
|
||||||
@ -1217,7 +1236,7 @@ class SMTPs
|
|||||||
// loop through all attachments
|
// loop through all attachments
|
||||||
foreach ( $_content as $_file => $_data )
|
foreach ( $_content as $_file => $_data )
|
||||||
{
|
{
|
||||||
$content .= "--" . $this->_getBoundary() . "\r\n"
|
$content .= "--" . $this->_getBoundary('mixed') . "\r\n"
|
||||||
. 'Content-Disposition: attachment; filename="' . $_data['fileName'] . '"' . "\r\n"
|
. 'Content-Disposition: attachment; filename="' . $_data['fileName'] . '"' . "\r\n"
|
||||||
. 'Content-Type: ' . $_data['mimeType'] . '; name="' . $_data['fileName'] . '"' . "\r\n"
|
. 'Content-Type: ' . $_data['mimeType'] . '; name="' . $_data['fileName'] . '"' . "\r\n"
|
||||||
. 'Content-Transfer-Encoding: base64' . "\r\n"
|
. 'Content-Transfer-Encoding: base64' . "\r\n"
|
||||||
@ -1235,7 +1254,7 @@ class SMTPs
|
|||||||
// loop through all images
|
// loop through all images
|
||||||
foreach ( $_content as $_image => $_data )
|
foreach ( $_content as $_image => $_data )
|
||||||
{
|
{
|
||||||
$content .= "--" . $this->_getBoundary() . "\r\n";
|
$content .= "--" . $this->_getBoundary('related') . "\r\n"; // always related for an inline image
|
||||||
|
|
||||||
$content .= 'Content-Type: ' . $_data['mimeType'] . '; name="' . $_data['imageName'] . '"' . "\r\n"
|
$content .= 'Content-Type: ' . $_data['mimeType'] . '; name="' . $_data['imageName'] . '"' . "\r\n"
|
||||||
. 'Content-Transfer-Encoding: base64' . "\r\n"
|
. 'Content-Transfer-Encoding: base64' . "\r\n"
|
||||||
@ -1248,11 +1267,25 @@ class SMTPs
|
|||||||
$content .= "\r\n"
|
$content .= "\r\n"
|
||||||
. $_data['data'] . "\r\n";
|
. $_data['data'] . "\r\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// always end related and end alternative after inline images
|
||||||
|
$content.= "--" . $this->_getBoundary('related') . "--" . "\r\n";
|
||||||
|
$content.= "\r\n" . "--" . $this->_getBoundary('alternative') . "--" . "\r\n";
|
||||||
|
$content.= "\r\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$content .= "--" . $this->_getBoundary() . "\r\n"
|
if (key_exists('image', $this->_msgContent))
|
||||||
. 'Content-Type: ' . $_content['mimeType'] . '; '
|
{
|
||||||
|
$content.= "Content-Type: text/plain; charset=" . $this->getCharSet() . "\r\n";
|
||||||
|
$content.= "\r\n" . strip_tags($_content['data']) . "\r\n"; // Add plain text message
|
||||||
|
$content.= "--" . $this->_getBoundary('alternative') . "\r\n";
|
||||||
|
$content.= 'Content-Type: multipart/related; boundary="' . $this->_getBoundary('related') . '"' . "\r\n";
|
||||||
|
$content.= "\r\n";
|
||||||
|
$content.= "--" . $this->_getBoundary('related') . "\r\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
$content .= 'Content-Type: ' . $_content['mimeType'] . '; '
|
||||||
// . 'charset="' . $this->getCharSet() . '"';
|
// . 'charset="' . $this->getCharSet() . '"';
|
||||||
. 'charset=' . $this->getCharSet() . '';
|
. 'charset=' . $this->getCharSet() . '';
|
||||||
|
|
||||||
@ -1273,7 +1306,7 @@ class SMTPs
|
|||||||
|
|
||||||
// Close message boundries
|
// Close message boundries
|
||||||
// $content .= "\r\n--" . $this->_getBoundary() . '--' . "\r\n" ;
|
// $content .= "\r\n--" . $this->_getBoundary() . '--' . "\r\n" ;
|
||||||
$content .= "--" . $this->_getBoundary() . '--' . "\r\n" ;
|
$content .= "--" . $this->_getBoundary('mixed') . '--' . "\r\n" ;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $content;
|
return $content;
|
||||||
@ -1457,6 +1490,8 @@ class SMTPs
|
|||||||
function _setBoundary()
|
function _setBoundary()
|
||||||
{
|
{
|
||||||
$this->_smtpsBoundary = "multipart_x." . time() . ".x_boundary";
|
$this->_smtpsBoundary = "multipart_x." . time() . ".x_boundary";
|
||||||
|
$this->_smtpsRelatedBoundary = 'mul_'.dol_hash(uniqid("dolibarr2"));
|
||||||
|
$this->_smtpsAlternativeBoundary = 'mul_'.dol_hash(uniqid("dolibarr3"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1464,9 +1499,11 @@ class SMTPs
|
|||||||
*
|
*
|
||||||
* @return string $_smtpsBoundary MIME message Boundary
|
* @return string $_smtpsBoundary MIME message Boundary
|
||||||
*/
|
*/
|
||||||
function _getBoundary()
|
function _getBoundary($type='mixed')
|
||||||
{
|
{
|
||||||
return $this->_smtpsBoundary;
|
if ($type == 'mixed') return $this->_smtpsBoundary;
|
||||||
|
else if ($type == 'related') return $this->_smtpsRelatedBoundary;
|
||||||
|
else if ($type == 'alternative') return $this->_smtpsAlternativeBoundary;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user