61 private $_smtpsPort = 25;
119 private $_msgContent = array();
144 'Company Confidential');
247 public $lastretval =
'';
264 private $_errorsTo =
'';
265 private $_deliveryReceipt = 0;
266 private $_trackId =
'';
267 private $_moreinheader =
'';
293 $this->_deliveryReceipt = $_val;
303 return $this->_deliveryReceipt;
314 $this->_trackId = $_val;
325 $this->_moreinheader = $_val;
335 return $this->_trackId;
345 return $this->_moreinheader;
371 if ($_part ===
true) {
372 $_retValue = $this->_errorsTo;
374 $_retValue = $this->_errorsTo[$_part];
388 $this->_debug = $_vDebug;
399 $_aryToList = $this->
getTo();
418 $usetls = preg_match(
'@tls://@i', $host);
420 $host = preg_replace(
'@tcp://@i',
'', $host);
421 $host = preg_replace(
'@ssl://@i',
'', $host);
422 $host = preg_replace(
'@tls://@i',
'', $host);
425 include_once DOL_DOCUMENT_ROOT.
'/core/lib/functions2.lib.php';
427 if ((!
is_ip($host)) && ((gethostbyname($host)) == $host)) {
428 $this->
_setErr(99, $host.
' is either offline or is an invalid host name.');
431 if (function_exists(
'stream_socket_client') && !empty($this->_options)) {
432 $socket_context = stream_context_create($this->_options);
433 $this->socket = @stream_socket_client(
434 preg_replace(
'@tls://@i',
'', $this->
getHost()).
439 STREAM_CLIENT_CONNECT,
443 $this->socket = @fsockopen(
444 preg_replace(
'@tls://@i',
'', $this->
getHost()),
453 if (is_resource($this->socket)) {
458 if (function_exists(
'stream_set_timeout')) {
459 stream_set_timeout($this->socket, $this->_smtpTimeout, 0);
463 if ($_retVal = $this->
server_parse($this->socket,
"220")) {
464 $_retVal = $this->socket;
469 if (empty($this->errstr)) {
470 $this->errstr =
'Failed to connect with fsockopen host='.$this->getHost().
' port='.$this->
getPort();
472 $this->
_setErr($this->errno, $this->errstr);
491 require_once DOL_DOCUMENT_ROOT.
'/core/lib/geturl.lib.php';
496 $usetls = preg_match(
'@tls://@i', $host);
498 $host = preg_replace(
'@tcp://@i',
'', $host);
499 $host = preg_replace(
'@ssl://@i',
'', $host);
500 $host = preg_replace(
'@tls://@i',
'', $host);
503 $host =
'tls://'.$host;
515 $hosth = $this->
getFrom(
'addr');
516 $hosth = preg_replace(
'/^.*</',
'', $hosth);
517 $hosth = preg_replace(
'/>.*$/',
'', $hosth);
518 $hosth = preg_replace(
'/.*@/',
'', $hosth);
521 global $dolibarr_main_url_root;
581 $this->
_setErr(131,
'STARTTLS connection is not supported.');
592 $crypto_method = STREAM_CRYPTO_METHOD_TLS_CLIENT;
593 if (defined(
'STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT')) {
594 $crypto_method |= STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT;
595 $crypto_method |= STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT;
598 if (!stream_socket_enable_crypto($this->socket,
true, $crypto_method)) {
599 $this->
_setErr(132,
'STARTTLS connection failed.');
605 $this->
_setErr(126,
'"'.$hosth.
'" does not support authenticated connections or temporary error. Error after 2nd sending EHLO '.$hosth.
' : '.$this->lastretval);
612 $conf->global->MAIN_MAIL_SMTPS_AUTH_TYPE =
'LOGIN';
617 switch ($conf->global->MAIN_MAIL_SMTPS_AUTH_TYPE) {
625 $_retVal = $this->
socket_send_str(base64_encode(
"\0".$this->_smtpsID.
"\0".$this->_smtpsPW),
'235');
631 $initRes =
"user=".$user.
"\001auth=Bearer ".$token.
"\001\001";
632 $_retVal = $this->
socket_send_str(
'AUTH XOAUTH2 '.base64_encode($initRes),
'235');
634 $this->
_setErr(130,
'Error when asking for AUTH XOAUTH2');
641 $this->
_setErr(130,
'Error when asking for AUTH LOGIN');
647 $_retVal = $this->
socket_send_str(base64_encode($this->_smtpsPW),
'235');
652 $this->
_setErr(130,
'Invalid Authentication Credentials.');
655 $this->
_setErr(126,
'"'.$host.
'" does not support authenticated connections or temporary error. Error after sending EHLO '.$hosth.
' : '.$this->lastretval);
668 require_once DOL_DOCUMENT_ROOT.
'/core/lib/geturl.lib.php';
676 if (!empty($this->_smtpsID) && (!empty($this->_smtpsPW) || !empty($this->_smtpsToken))) {
683 $usetls = preg_match(
'@tls://@i', $host);
685 $host = preg_replace(
'@tcp://@i',
'', $host);
686 $host = preg_replace(
'@ssl://@i',
'', $host);
687 $host = preg_replace(
'@tls://@i',
'', $host);
690 $host =
'tls://'.$host;
702 $hosth = $this->
getFrom(
'addr');
703 $hosth = preg_replace(
'/^.*</',
'', $hosth);
704 $hosth = preg_replace(
'/>.*$/',
'', $hosth);
705 $hosth = preg_replace(
'/.*@/',
'', $hosth);
708 global $dolibarr_main_url_root;
723 if (!$resultmailfrom) {
724 fclose($this->socket);
759 fwrite($this->socket,
'QUIT');
764 fclose($this->socket);
809 if (!empty($_strConfigPath)) {
812 if (!@include $_strConfigPath) {
813 $this->
_setErr(110,
'"'.$_strConfigPath.
'" is not a valid path.');
820 if ($_host = ini_get(
'SMTPs')) {
824 if ($_port = ini_get(
'smtp_port')) {
828 if ($_from = ini_get(
'sendmail_from')) {
848 if ((is_numeric($_type)) && (($_type >= 0) && ($_type <= 3))) {
849 $this->_transportType = $_type;
892 $this->_smtpsHost = $_strHost;
917 if ((is_numeric($_intPort)) &&
918 (($_intPort >= 1) && ($_intPort <= 65536))) {
919 $this->_smtpsPort = (int) $_intPort;
931 return (
int) $this->_smtpsPort;
942 $this->_smtpsID = $_strID;
963 $this->_smtpsPW = $_strPW;
984 $this->_smtpsToken = $_strToken;
1007 $this->_smtpsCharSet = $_strCharSet;
1038 if (array_search($_strTransEncode, $this->_smtpsTransEncodeTypes)) {
1039 $this->_smtpsTransEncode = $_strTransEncode;
1071 if (array_search($_strTransEncodeType, $this->_smtpsTransEncodeTypes)) {
1072 $this->_smtpsTransEncodeType = $_strTransEncodeType;
1112 if ($_part ===
true) {
1115 $_retValue = $this->_msgFrom[$_part];
1130 $this->_msgReplyTo = $this->
_strip_email($_strReplyTo);
1144 if ($_part ===
true) {
1147 $_retValue = $this->_msgReplyTo[$_part];
1161 if ($_strInReplyTo) {
1162 $this->_msgInReplyTo = $_strInReplyTo;
1186 if ($_strReferences) {
1187 $this->_msgReferences = $_strReferences;
1219 if (!empty($_addrList)) {
1221 if (is_string($_addrList)) {
1223 if (strstr($_addrList,
',')) {
1225 $_addrList = explode(
',', $_addrList);
1228 $_addrList = array($_addrList);
1233 foreach ($_addrList as $_strAddr) {
1235 $_strAddr = str_replace(
'>',
'', $_strAddr);
1239 $_tmpaddr = explode(
'<', $_strAddr);
1242 if (count($_tmpaddr) == 2) {
1243 $_tmpHost = explode(
'@', $_tmpaddr[1]);
1244 $_tmpaddr[0] = trim($_tmpaddr[0],
' ">');
1245 $aryHost[$_tmpHost[1]][$_type][$_tmpHost[0]] = $_tmpaddr[0];
1249 $_strAddr = str_replace(
'<',
'', $_strAddr);
1251 $_tmpHost = explode(
'@', $_strAddr);
1252 $_tmpHost[0] = trim($_tmpHost[0]);
1253 $_tmpHost[1] = trim($_tmpHost[1]);
1255 $aryHost[$_tmpHost[1]][$_type][$_tmpHost[0]] =
'';
1260 $this->_msgRecipients = $aryHost;
1283 $_aryEmail = array();
1285 $_aryEmail[
'org'] = $_strAddr;
1288 $_strAddr = strtolower($_strAddr);
1291 $_strAddr = trim($_strAddr,
' ">');
1294 $_tmpAry = explode(
'<', $_strAddr);
1297 if (count($_tmpAry) == 2) {
1300 $_aryEmail[
'real'] = trim($_tmpAry[0],
' ">');
1303 $_aryEmail[
'addr'] = $_tmpAry[1];
1305 $_aryEmail[
'addr'] = $_tmpAry[0];
1309 $_tmpHost = explode(
'@', $_aryEmail[
'addr']);
1310 $_aryEmail[
'user'] = $_tmpHost[0];
1311 $_aryEmail[
'host'] = $_tmpHost[1];
1314 $_aryEmail[
'addr'] =
'<'.$_aryEmail[
'addr'].
'>';
1333 $_RCPT_list = array();
1336 foreach ($this->_msgRecipients as $_host => $_list) {
1337 foreach ($_list as $_subList) {
1338 foreach ($_subList as $_name => $_addr) {
1340 $_RCPT_list[] = $_name.
'@'.$_host;
1361 if ($this->_msgRecipients) {
1362 $_RCPT_list = array();
1364 foreach ($this->_msgRecipients as $_host => $_list) {
1365 if (!empty($this->_msgRecipients[$_host][$_which])) {
1366 foreach ($this->_msgRecipients[$_host][$_which] as $_addr => $_realName) {
1368 $_realName =
'"'.$_realName.
'"';
1369 $_RCPT_list[] = $_realName.
' <'.$_addr.
'@'.$_host.
'>';
1371 $_RCPT_list[] = $_addr.
'@'.$_host;
1377 return implode(
', ', $_RCPT_list);
1379 $this->
_setErr(101,
'No eMail Address for message to be sent to.');
1383 $this->
_setErr(102,
'eMail type not defined.');
1466 $this->_msgSubject = $_strSubject;
1489 $_header =
'From: '.$this->getFrom(
'org').
"\r\n"
1490 .
'To: '.$this->getTo().
"\r\n";
1492 if ($this->
getCC()) {
1493 $_header .=
'Cc: '.$this->getCC().
"\r\n";
1507 $host = dol_getprefix(
'email');
1510 $_header .=
'Subject: '.$this->getSubject().
"\r\n";
1511 $_header .=
'Date: '.date(
"r").
"\r\n";
1515 $_header .=
'Message-ID: <'.time().
'.SMTPs-dolibarr-'.$trackid.
'@'.$host.
">\r\n";
1516 $_header .=
'X-Dolibarr-TRACKID: '.$trackid.
'@'.$host.
"\r\n";
1518 $_header .=
'Message-ID: <'.time().
'.SMTPs@'.$host.
">\r\n";
1520 if (!empty($_SERVER[
'REMOTE_ADDR'])) {
1521 $_header .=
"X-RemoteAddr: ".$_SERVER[
'REMOTE_ADDR'].
"\r\n";
1528 $_header .=
'Sensitivity: '.$this->getSensitivity().
"\r\n";
1531 if ($this->_msgPriority != 3) {
1538 $_header .=
'Disposition-Notification-To: '.$this->getFrom(
'addr').
"\r\n";
1541 $_header .=
'Errors-To: '.$this->getErrorsTo(
'addr').
"\r\n";
1544 $_header .=
"Reply-To: ".$this->getReplyTo(
'addr').
"\r\n";
1547 $_header .=
'X-Mailer: Dolibarr version '.DOL_VERSION.
' (using SMTPs Mailer)'.
"\r\n";
1548 $_header .=
'X-Dolibarr-Option: '.($conf->global->MAIN_MAIL_USE_MULTI_PART ?
'MAIN_MAIL_USE_MULTI_PART' :
'No MAIN_MAIL_USE_MULTI_PART').
"\r\n";
1549 $_header .=
'Mime-Version: 1.0'.
"\r\n";
1553 $_header .=
"In-Reply-To: ".$this->getInReplyTo().
"\r\n";
1556 $_header .=
"References: ".$this->getReferences().
"\r\n";
1573 if ($strType ==
'html') {
1574 $strMimeType =
'text/html';
1576 $strMimeType =
'text/plain';
1580 $strContent = preg_replace(
"/(?<!\r)\n/si",
"\r\n", $strContent);
1582 $strContentAltText =
'';
1583 if ($strType ==
'html') {
1585 $strContentAltText = preg_replace(
'/<head><title>.*<\/style><\/head>/',
'', $strContent);
1586 $strContentAltText = preg_replace(
"/<br\s*[^>]*>/",
" ", $strContentAltText);
1587 $strContentAltText = html_entity_decode(strip_tags($strContentAltText));
1588 $strContentAltText = trim(wordwrap($strContentAltText, 75,
"\r\n"));
1593 $strContent = rtrim(wordwrap($strContent, 75,
"\r\n"));
1595 $this->_msgContent[$strType] = array();
1597 $this->_msgContent[$strType][
'mimeType'] = $strMimeType;
1598 $this->_msgContent[$strType][
'data'] = $strContent;
1599 $this->_msgContent[$strType][
'dataText'] = $strContentAltText;
1602 $this->_msgContent[$strType][
'md5'] =
dol_hash($strContent, 3);
1620 $_types = array_keys($this->_msgContent);
1623 $keyCount = count($_types);
1626 if ($keyCount === 0) {
1627 die(
"Sorry, no content");
1630 $_msgData = $this->_msgContent;
1631 $_msgData = $_msgData[$_types[0]];
1633 $content =
'Content-Type: '.$_msgData[
'mimeType'].
'; charset="'.$this->
getCharSet().
'"'.
"\r\n"
1634 .
'Content-Transfer-Encoding: '.$this->getTransEncodeType().
"\r\n"
1635 .
'Content-Disposition: inline'.
"\r\n"
1636 .
'Content-Description: Message'.
"\r\n";
1639 $content .=
'Content-MD5: '.$_msgData[
'md5'].
"\r\n";
1643 . $_msgData[
'data'].
"\r\n";
1651 $content =
'Content-Type: multipart/mixed; boundary="'.$this->_getBoundary(
'mixed').
'"'.
"\r\n";
1655 $content .=
"Content-Transfer-Encoding: 8bit\r\n";
1658 $content .=
"--".$this->_getBoundary(
'mixed').
"\r\n";
1660 if (array_key_exists(
'image', $this->_msgContent)) {
1661 $content .=
'Content-Type: multipart/alternative; boundary="'.$this->_getBoundary(
'alternative').
'"'.
"\r\n";
1663 $content .=
"--".$this->_getBoundary(
'alternative').
"\r\n";
1671 foreach ($this->_msgContent as $type => $_content) {
1672 if ($type ==
'attachment') {
1674 foreach ($_content as $_file => $_data) {
1675 $content .=
"--".$this->_getBoundary(
'mixed').
"\r\n"
1676 .
'Content-Disposition: attachment; filename="'.$_data[
'fileName'].
'"'.
"\r\n"
1677 .
'Content-Type: '.$_data[
'mimeType'].
'; name="'.$_data[
'fileName'].
'"'.
"\r\n"
1678 .
'Content-Transfer-Encoding: base64'.
"\r\n"
1679 .
'Content-Description: '.$_data[
'fileName'].
"\r\n";
1680 if (!empty($_data[
'cid'])) {
1681 $content .=
"X-Attachment-Id: ".$_data[
'cid'].
"\r\n";
1682 $content .=
"Content-ID: <".$_data[
'cid'].
">\r\n";
1685 $content .=
'Content-MD5: '.$_data[
'md5'].
"\r\n";
1688 $content .=
"\r\n".$_data[
'data'].
"\r\n\r\n";
1690 } elseif ($type ==
'image') {
1693 foreach ($_content as $_image => $_data) {
1694 $content .=
"--".$this->_getBoundary(
'related').
"\r\n";
1696 $content .=
'Content-Type: '.$_data[
'mimeType'].
'; name="'.$_data[
'imageName'].
'"'.
"\r\n"
1697 .
'Content-Transfer-Encoding: base64'.
"\r\n"
1698 .
'Content-Disposition: inline; filename="'.$_data[
'imageName'].
'"'.
"\r\n"
1699 .
'Content-ID: <'.$_data[
'cid'].
'> '.
"\r\n";
1702 $content .=
'Content-MD5: '.$_data[
'md5'].
"\r\n";
1706 . $_data[
'data'].
"\r\n";
1710 $content .=
"--".$this->_getBoundary(
'related').
"--\r\n";
1711 $content .=
"\r\n--".$this->_getBoundary(
'alternative').
"--\r\n";
1714 if (array_key_exists(
'image', $this->_msgContent)) {
1715 $content .=
"Content-Type: text/plain; charset=".$this->getCharSet().
"\r\n";
1716 $content .=
"\r\n".($_content[
'dataText'] ? $_content[
'dataText'] : strip_tags($_content[
'data'])).
"\r\n";
1717 $content .=
"--".$this->_getBoundary(
'alternative').
"\r\n";
1718 $content .=
'Content-Type: multipart/related; boundary="'.$this->_getBoundary(
'related').
'"'.
"\r\n";
1720 $content .=
"--".$this->_getBoundary(
'related').
"\r\n";
1723 if (!array_key_exists(
'image', $this->_msgContent) && $_content[
'dataText'] &&
getDolGlobalString(
'MAIN_MAIL_USE_MULTI_PART')) {
1725 $content .=
'Content-Type: multipart/alternative; boundary="'.$this->_getBoundary(
'alternative').
'"'.
"\r\n";
1727 $content .=
"--".$this->_getBoundary(
'alternative').
"\r\n";
1729 $content .=
"Content-Type: text/plain; charset=".$this->getCharSet().
"\r\n";
1730 $content .=
"\r\n".$_content[
'dataText'].
"\r\n";
1731 $content .=
"--".$this->_getBoundary(
'alternative').
"\r\n";
1734 $content .=
'Content-Type: '.$_content[
'mimeType'].
'; charset='.$this->
getCharSet();
1739 $content .=
'Content-MD5: '.$_content[
'md5'].
"\r\n";
1742 $content .=
"\r\n".$_content[
'data'].
"\r\n";
1744 if (!array_key_exists(
'image', $this->_msgContent) && $_content[
'dataText'] &&
getDolGlobalString(
'MAIN_MAIL_USE_MULTI_PART')) {
1746 $content .=
"--".$this->_getBoundary(
'alternative').
"--\r\n";
1753 $content .=
"--".$this->_getBoundary(
'mixed').
'--'.
"\r\n";
1755 die(
"Sorry, no content");
1771 public function setAttachment($strContent, $strFileName =
'unknown', $strMimeType =
'unknown', $strCid =
'')
1774 $strContent = rtrim(chunk_split(base64_encode($strContent), 76,
"\r\n"));
1776 $this->_msgContent[
'attachment'][$strFileName][
'mimeType'] = $strMimeType;
1777 $this->_msgContent[
'attachment'][$strFileName][
'fileName'] = $strFileName;
1778 $this->_msgContent[
'attachment'][$strFileName][
'data'] = $strContent;
1779 $this->_msgContent[
'attachment'][$strFileName][
'cid'] = $strCid;
1782 $this->_msgContent[
'attachment'][$strFileName][
'md5'] =
dol_hash($strContent, 3);
1800 public function setImageInline($strContent, $strImageName =
'unknown', $strMimeType =
'unknown', $strImageCid =
'unknown')
1803 $this->_msgContent[
'image'][$strImageName][
'mimeType'] = $strMimeType;
1804 $this->_msgContent[
'image'][$strImageName][
'imageName'] = $strImageName;
1805 $this->_msgContent[
'image'][$strImageName][
'cid'] = $strImageCid;
1806 $this->_msgContent[
'image'][$strImageName][
'data'] = $strContent;
1809 $this->_msgContent[
'image'][$strImageName][
'md5'] =
dol_hash($strContent, 3);
1829 if ((is_numeric($_value)) &&
1830 (($_value >= 0) && ($_value <= 3))) {
1831 $this->_msgSensitivity = $_value;
1865 if ((is_numeric($_value)) &&
1866 (($_value >= 0) && ($_value <= 5))) {
1867 $this->_msgPriority = $_value;
1887 .
'X-Priority: '.$this->_msgPriority.
' ('.$this->_aryPriority[
$this->_msgPriority].
')'.
"\r\n";
1898 $this->_smtpMD5 = $_flag;
1922 $this->_msgXheader[] = $strXdata;
1943 $this->_smtpsBoundary =
"multipart_x.".time().
".x_boundary";
1944 $this->_smtpsRelatedBoundary =
'mul_'.dol_hash(uniqid(
"dolibarr2"), 3);
1945 $this->_smtpsAlternativeBoundary =
'mul_'.dol_hash(uniqid(
"dolibarr3"), 3);
1956 if ($type ==
'mixed') {
1958 } elseif ($type ==
'related') {
1960 } elseif ($type ==
'alternative') {
1986 $server_response =
'';
1991 while (substr($server_response, 3, 1) !=
' ' && $limit < 100) {
1992 if (!($server_response = fgets($socket, 256))) {
1993 $this->
_setErr(121,
"Couldn't get mail server response codes");
1997 $this->log .= $server_response;
2001 $this->lastretval = substr($server_response, 0, 3);
2003 if (!(substr($server_response, 0, 3) == $response)) {
2004 $this->
_setErr(120,
"Ran into problems sending Mail.\r\nResponse: ".$server_response);
2023 if ($this->_debug) {
2024 $this->log .= $_strSend;
2026 fwrite($this->socket, $_strSend.$CRLF);
2027 if ($this->_debug) {
2028 $this->log .=
' ('.$_returnCode.
')'.$CRLF;
2032 return $this->
server_parse($this->socket, $_returnCode);
2050 $this->_smtpsErrors[] = array(
2065 if (is_array($this->_smtpsErrors)) {
2066 foreach ($this->_smtpsErrors as $_err => $_info) {
2067 $_errMsg[] =
'Error ['.$_info[
'num'].
']: '.$_info[
'msg'];
2071 return implode(
"\n", $_errMsg);
Class to construct and send SMTP compliant email, even to a secure SMTP server, regardless of platfor...
$_smtpsToken
Token in case we use OAUTH2.
_getBoundary($type='mixed')
Retrieves the MIME message Boundary.
setConfig($_strConfigPath=null)
setConfig() is used to populate select class properties from either a user defined INI file or the sy...
sendMsg()
Now send the message.
$_arySensitivity
Message Sensitivity.
$_smtpsCharSet
Character set Defaulted to 'iso-8859-1'.
getErrors()
Returns applicative errors codes and messages for Class (not the SMTP error code)
setCharSet($_strCharSet)
Character set used for current message Character set is defaulted to 'iso-8859-1';.
setSubject($_strSubject='')
Message Subject.
getPriority()
Message Content Priority Message Priority values:
$_smtpsHost
Host Name or IP of SMTP Server to use.
setReferences($_strReferences)
Set References in the list of Msg-Id.
getMD5flag()
Gets flag which determines whether to calculate message MD5 checksum.
socket_send_str($_strSend, $_returnCode=null, $CRLF="\r\n")
Send str.
_strip_email($_strAddr)
Returns an array of the various parts of an email address This assumes a well formed address:
getTransEncodeType()
Retrieves the Content-Transfer-Encoding.
setTrackId($_val='')
Set trackid.
setToken($_strToken)
User token for OAUTH2.
setInReplyTo($_strInReplyTo)
Set References in the list of Msg-Id.
buildRCPTlist()
build RECIPIENT List, all addresses who will receive this message
getBodyContent()
Retrieves the Message Content.
_buildAddrList($_type, $_addrList)
Inserts given addresses into structured format.
getInReplyTo()
Retrieves the InReplyTo from which mail we reply to.
setOptions($_options=array())
Set delivery receipt.
_server_connect()
Attempt a connection to mail server.
setBodyContent($strContent, $strType='plain')
Message Content.
server_parse($socket, $response)
This function has been modified as provided by SirSir to allow multiline responses when using SMTP Ex...
setTransportType($_type=0)
Determines the method inwhich the messages are to be sent.
getBCC()
Retrieves the BCC Address[es] inwhich to send mail to.
$_smtpsTransEncodeTypes
Content-Transfer-Encoding.
setAttachment($strContent, $strFileName='unknown', $strMimeType='unknown', $strCid='')
File attachments are added to the content array as sub-arrays, allowing for multiple attachments for ...
_setBoundary()
Generates Random string for MIME message Boundary.
getTo()
Retrieves the TO Address[es] inwhich to send mail to.
setPort($_intPort)
Defines the Port Number of the Mail Server to use The default is 25 This is used only with 'socket' b...
getID()
Retrieves the User Name for authentication on Mail Server.
setBCC($_strBCC)
BCC Address[es] inwhich to send mail to.
setReplyTo($_strReplyTo)
Reply-To Address from which mail will be the reply-to.
getToken()
Retrieves the User token for OAUTH2.
setSensitivity($_value=0)
Message Content Sensitivity Message Sensitivity values:
setCC($_strCC)
CC Address[es] inwhich to send mail to.
$_msgReplyTo
Where are replies and errors to be sent to This can be defined via a INI file or via a setter method.
$_smtpsID
Secure SMTP Server access ID This can be defined via a INI file or via a setter method.
setTO($_addrTo)
TO Address[es] inwhich to send mail to.
setTransEncodeType($_strTransEncodeType)
Content-Transfer-Encoding, Defaulted to '0' [ZERO] This can be changed for 2byte characters sets Know...
get_email_list($_which=null)
Returns an array of addresses for a specific type; TO, CC or BCC.
setMD5flag($_flag=false)
Set flag which determines whether to calculate message MD5 checksum.
getCharSet()
Retrieves the Character set used for current message.
getCC()
Retrieves the CC Address[es] inwhich to send mail to.
getDeliveryReceipt()
get delivery receipt
setFrom($_strFrom)
FROM Address from which mail will be sent.
get_RCPT_list()
Returns an array of bares addresses for use with 'RCPT TO:' This is a "build as you go" method.
_server_authenticate()
Attempt mail server authentication for a secure connection.
setID($_strID)
User Name for authentication on Mail Server.
getMoreInHeader()
get moreInHeader
$_log_level
Defines log level 0 - no logging 1 - connectivity logging 2 - message generation logging 3 - detail l...
getPW()
Retrieves the User Password for authentication on Mail Server.
getSubject()
Retrieves the Message Subject.
getXheader()
Retrieves the Message X-Header Content.
$_msgReferences
List of Msg-Id.
$_msgFrom
Who sent the Message This can be defined via a INI file or via a setter method.
setErrorsTo($_strErrorsTo)
Set errors to.
$_smtpsTransEncodeType
Content-Transfer-Encoding Defaulted to 0 - 7bit.
setImageInline($strContent, $strImageName='unknown', $strMimeType='unknown', $strImageCid='unknown')
Image attachments are added to the content array as sub-arrays, allowing for multiple images for each...
$_smtpsTransEncode
Content-Transfer-Encoding Defaulted to '7bit'.
$_smtpTimeout
Sets the SMTP server timeout in seconds.
$_smtpsRelatedBoundary
Related Boundary.
setHost($_strHost)
Defines the Host Name or IP of the Mail Server to use.
$_msgPriority
Message Sensitivity Defaults to 3 - Normal.
getFrom($_part=true)
Retrieves the Address from which mail will be sent.
getHost()
Retrieves the Host Name or IP of the Mail Server to use This is used only with 'socket' based mail tr...
$_msgSensitivity
Message Sensitivity Defaults to ZERO - None.
setPW($_strPW)
User Password for authentication on Mail Server.
$_smtpsErrors
Class error codes and messages.
$_msgSubject
Message Subject.
getReplyTo($_part=true)
Retrieves the Address from which mail will be the reply-to.
setPriority($_value=3)
Message Content Priority Message Priority values:
setMoreInHeader($_val='')
Set moreInHeader.
$_smtpMD5
Determines whether to calculate message MD5 checksum.
$_smtpsAlternativeBoundary
Alternative Boundary.
$_aryPriority
Message Priority.
$_smtpsBoundary
Boundary String for MIME separation.
getErrorsTo($_part=true)
Get errors to.
getSensitivity()
Returns Message Content Sensitivity string Message Sensitivity values:
getPort()
Retrieves the Port Number of the Mail Server to use This is used only with 'socket' based mail transm...
$_msgXheader
Custom X-Headers.
$_options
An array of options for stream_context_create()
$_smtpsPW
Secure SMTP Server access Password This can be defined via a INI file or via a setter method.
$_msgInReplyTo
List of In-Reply-To.
getTransportType()
Return the method inwhich the message is to be sent.
setMailPath($_path)
Path to the sendmail executable.
getTransEncode()
Retrieves the Content-Transfer-Encoding.
getReferences()
Retrieves the References from which mail will be the reply-to.
setTransEncode($_strTransEncode)
Content-Transfer-Encoding, Defaulted to '7bit' This can be changed for 2byte characters sets Known En...
$_mailPath
If '$_transportType' is set to '1', then this variable is used to define the UNIX file system path to...
setDebug($_vDebug=false)
Set debug.
$_msgRecipients
Who will the Message be sent to; TO, CC, BCC Multi-diminsional array containing addresses the message...
setDeliveryReceipt($_val=0)
Set delivery receipt.
_setErr($_errNum, $_errMsg)
Defines errors codes and messages for Class.
getHeader()
Constructs and returns message header.
$_debug
Place Class in" debug" mode.
setXheader($strXdata)
Message X-Header Content This is a simple "insert".
$_transportType
Determines the method inwhich the message are to be sent.
is_ip($ip)
This function evaluates a string that should be a valid IPv4 Note: For ip 169.254....
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
getDolGlobalString($key, $default='')
Return dolibarr global constant string value.
getDomainFromURL($url, $mode=0)
Function get second level domain name.
dol_hash($chain, $type='0', $nosalt=0)
Returns a hash (non reversible encryption) of a string.