dolibarr 24.0.0-beta
SMTPs Class Reference

Class to construct and send SMTP compliant email, even to a secure SMTP server, regardless of platform. More...

Public Member Functions

 setMessageID ($_msgId='')
 Set Message-ID.
 
 setOptions ($_options=array())
 Set options.
 
 setDeliveryReceipt ($_val=0)
 Set delivery receipt.
 
 getDeliveryReceipt ()
 get delivery receipt
 
 setSMTPTimeout ($timeout)
 Set socket timeout.
 
 getSMTPTimeout ()
 Get socket timeout.
 
 setTrackId ($_val='')
 Set trackid.
 
 setMoreInHeader ($_val='')
 Set moreInHeader.
 
 getTrackId ()
 get trackid
 
 getMoreInHeader ()
 get moreInHeader
 
 setErrorsTo ($_strErrorsTo)
 Set errors to.
 
 getErrorsTo ($_part=true)
 Get errors to.
 
 setDebug ($_vDebug=false)
 Set debug.
 
 buildRCPTlist ()
 build RECIPIENT List, all addresses who will receive this message
 
 sendMsg ()
 Now send the message.
 
 setConfig ($_strConfigPath=null)
 setConfig() is used to populate select class properties from either a user defined INI file or the systems 'php.ini' file
 
 setTransportType ($_type=0)
 Determines the method inwhich the messages are to be sent.
 
 getTransportType ()
 Return the method inwhich the message is to be sent.
 
 setMailPath ($_path)
 Path to the sendmail executable.
 
 setHost ($_strHost)
 Defines the Host Name or IP of the Mail Server to use.
 
 getHost ()
 Retrieves the Host Name or IP of the Mail Server to use This is used only with 'socket' based mail transmission.
 
 setPort ($_intPort)
 Defines the Port Number of the Mail Server to use The default is 25 This is used only with 'socket' based mail transmission.
 
 getPort ()
 Retrieves the Port Number of the Mail Server to use This is used only with 'socket' based mail transmission.
 
 setID ($_strID)
 User Name for authentication on Mail Server.
 
 getID ()
 Retrieves the User Name for authentication on Mail Server.
 
 setPW ($_strPW)
 User Password for authentication on Mail Server.
 
 getPW ()
 Retrieves the User Password for authentication on Mail Server.
 
 setToken ($_strToken)
 User token for OAUTH2.
 
 getToken ()
 Retrieves the User token for OAUTH2.
 
 setCharSet ($_strCharSet)
 Character set used for current message Character set is defaulted to 'iso-8859-1';.
 
 getCharSet ()
 Retrieves the Character set used for current message.
 
 setTransEncode ($_strTransEncode)
 Content-Transfer-Encoding, Defaulted to '7bit' This can be changed for 2byte characters sets Known Encode Types.
 
 getTransEncode ()
 Retrieves the Content-Transfer-Encoding.
 
 setTransEncodeType ($_strTransEncodeType)
 Content-Transfer-Encoding, Defaulted to '0' [ZERO] This can be changed for 2byte characters sets Known Encode Types.
 
 getTransEncodeType ()
 Retrieves the Content-Transfer-Encoding.
 
 setFrom ($_strFrom)
 FROM Address from which mail will be sent.
 
 getFrom ($_part=true)
 Retrieves the Address from which mail will be sent.
 
 setReplyTo ($_strReplyTo)
 Reply-To Address from which mail will be the reply-to.
 
 getReplyTo ($_part=true)
 Retrieves the Address from which mail will be the reply-to.
 
 setInReplyTo ($_strInReplyTo)
 Set References in the list of Msg-Id.
 
 getInReplyTo ()
 Retrieves the InReplyTo from which mail we reply to.
 
 setReferences ($_strReferences)
 Set References in the list of Msg-Id.
 
 getReferences ()
 Retrieves the References from which mail will be the reply-to.
 
 get_RCPT_list ()
 Returns an array of bare addresses for use with 'RCPT TO:' This is a "build as you go" method.
 
 get_email_list ($_which=null)
 Returns an array of addresses for a specific type; TO, CC or BCC.
 
 setTO ($_addrTo)
 TO Address[es] inwhich to send mail to.
 
 getTo ()
 Retrieves the TO Address[es] inwhich to send mail to.
 
 setCC ($_strCC)
 CC Address[es] inwhich to send mail to.
 
 getCC ()
 Retrieves the CC Address[es] inwhich to send mail to.
 
 setBCC ($_strBCC)
 BCC Address[es] inwhich to send mail to.
 
 getBCC ()
 Retrieves the BCC Address[es] inwhich to send mail to.
 
 setSubject ($_strSubject='')
 Message Subject.
 
 getSubject ()
 Retrieves the Message Subject.
 
 getHeader ()
 Constructs and returns message header.
 
 setBodyContent ($strContent, $strType='plain')
 Message Content.
 
 getBodyContent ()
 Retrieves the Message Content.
 
 setAttachment ($strContent, $strFileName='unknown', $strMimeType='unknown', $strCid='')
 File attachments are added to the content array as sub-arrays, allowing for multiple attachments for each outbound email.
 
 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 outbound email.
 
 setSensitivity ($_value=0)
 Message Content Sensitivity Message Sensitivity values:
 
 getSensitivity ()
 Returns Message Content Sensitivity string Message Sensitivity values:
 
 setPriority ($_value=3)
 Message Content Priority Message Priority values:
 
 getPriority ()
 Message Content Priority Message Priority values:
 
 setMD5flag ($_flag=false)
 Set flag which determines whether to calculate message MD5 checksum.
 
 getMD5flag ()
 Gets flag which determines whether to calculate message MD5 checksum.
 
 setXheader ($strXdata)
 Message X-Header Content This is a simple "insert".
 
 getXheader ()
 Retrieves the Message X-Header Content.
 
 server_parse ($socket, $response)
 This function has been modified as provided by SirSir to allow multiline responses when using SMTP Extensions.
 
 socket_send_str ($_strSend, $_returnCode=null, $CRLF="\r\n")
 Send str.
 
 getErrors ()
 Returns applicative errors codes and messages for Class (not the SMTP error code)
 

Private Member Functions

 _server_connect ()
 Attempt a connection to mail server.
 
 _server_authenticate ()
 Attempt mail server authentication for a secure connection.
 
 _buildAddrList ($_type, $_addrList)
 Inserts given addresses into structured format.
 
 _strip_email ($_strAddr)
 Returns an array of the various parts of an email address This assumes a well formed address:
 
 _setBoundary ()
 Generates Random string for MIME message Boundary.
 
 _getBoundary ($type='mixed')
 Retrieves the MIME message Boundary.
 
 _setErr ($_errNum, $_errMsg)
 Defines errors codes and messages for Class.
 

Detailed Description

Class to construct and send SMTP compliant email, even to a secure SMTP server, regardless of platform.

Definition at line 48 of file smtps.class.php.

Member Function Documentation

◆ _buildAddrList()

SMTPs::_buildAddrList ( $_type,
$_addrList )
private

Inserts given addresses into structured format.

This method takes a list of given addresses, via an array or a COMMA delimited string, and inserts them into a highly structured array. This array is designed to remove duplicate addresses and to sort them by Domain.

Parameters
string$_typeTO, CC, or BCC lists to add addrresses into
mixed$_addrListArray or COMMA delimited string of addresses
Returns
void

Definition at line 1270 of file smtps.class.php.

Referenced by setBCC(), setCC(), and setTO().

◆ _getBoundary()

SMTPs::_getBoundary ( $type = 'mixed')
private

Retrieves the MIME message Boundary.

Parameters
string$typeType of boundary
Returns
string $_smtpsBoundary MIME message Boundary

Definition at line 2013 of file smtps.class.php.

◆ _server_authenticate()

SMTPs::_server_authenticate ( )
private

Attempt mail server authentication for a secure connection.

Returns
boolean|null $_retVal Boolean indicating success or failure of authentication

Definition at line 546 of file smtps.class.php.

References $conf, $dolibarr_main_url_root, _setErr(), getDolGlobalInt(), getDolGlobalString(), getDomainFromURL(), getFrom(), getHost(), socket_send_str(), and string.

Referenced by sendMsg().

◆ _server_connect()

SMTPs::_server_connect ( )
private

Attempt a connection to mail server.

Returns
mixed $_retVal Boolean indicating success or failure on connection

Definition at line 468 of file smtps.class.php.

References _setErr(), getHost(), getPort(), is_ip(), and server_parse().

Referenced by sendMsg().

◆ _setBoundary()

SMTPs::_setBoundary ( )
private

Generates Random string for MIME message Boundary.

Returns
void

Definition at line 2000 of file smtps.class.php.

Referenced by getBodyContent().

◆ _setErr()

SMTPs::_setErr ( $_errNum,
$_errMsg )
private

Defines errors codes and messages for Class.

Parameters
int$_errNumError Code Number
string$_errMsgError Message
Returns
void

Definition at line 2107 of file smtps.class.php.

Referenced by _server_authenticate(), _server_connect(), get_email_list(), server_parse(), and setConfig().

◆ _strip_email()

SMTPs::_strip_email ( $_strAddr)
private

Returns an array of the various parts of an email address This assumes a well formed address:

  • "Real name" usern.nosp@m.ame@.nosp@m.domai.nosp@m.n.tl.nosp@m.d
  • "Real Name" is optional
  • if "Real Name" does not exist, the angle brackets are optional This will split an email address into 4 or 5 parts.
  • $_aryEmail[org] = original string
  • $_aryEmail[real] = "real name" - if there is one
  • $_aryEmail[addr] = address part "username@domain.tld"
  • $_aryEmail[host] = "domain.tld"
  • $_aryEmail[user] = "userName"
Parameters
string$_strAddrEmail address
Returns
array{org:string,real?:string,addr:string,user:string,host:string} An array of the various parts of an email address

Definition at line 1337 of file smtps.class.php.

Referenced by setErrorsTo(), setFrom(), and setReplyTo().

◆ buildRCPTlist()

SMTPs::buildRCPTlist ( )

build RECIPIENT List, all addresses who will receive this message

Returns
void

Definition at line 456 of file smtps.class.php.

References getTo().

◆ get_email_list()

SMTPs::get_email_list ( $_which = null)

Returns an array of addresses for a specific type; TO, CC or BCC.

Parameters
string$_whichWhich collection of addresses to return ('to', 'cc', 'bcc')
Returns
string|false Array of emaill address

Definition at line 1412 of file smtps.class.php.

References _setErr().

Referenced by getBCC(), getCC(), and getTo().

◆ get_RCPT_list()

SMTPs::get_RCPT_list ( )

Returns an array of bare addresses for use with 'RCPT TO:' This is a "build as you go" method.

Each time this method is called the underlying array is destroyed and reconstructed.

Returns
string[] Returns an array of bare addresses

An array of bares addresses for use with 'RCPT TO:'

Definition at line 1384 of file smtps.class.php.

Referenced by sendMsg().

◆ getBCC()

SMTPs::getBCC ( )

Retrieves the BCC Address[es] inwhich to send mail to.

Returns
string BCC Address[es] inwhich to send mail to

Definition at line 1509 of file smtps.class.php.

References get_email_list().

◆ getBodyContent()

SMTPs::getBodyContent ( )

Retrieves the Message Content.

Returns
string Message Content

Definition at line 1671 of file smtps.class.php.

References $conf, _setBoundary(), getCharSet(), getDolGlobalString(), and getMD5flag().

Referenced by sendMsg().

◆ getCC()

SMTPs::getCC ( )

Retrieves the CC Address[es] inwhich to send mail to.

Returns
string CC Address[es] inwhich to send mail to

Definition at line 1486 of file smtps.class.php.

References get_email_list().

Referenced by getHeader().

◆ getCharSet()

SMTPs::getCharSet ( )

Retrieves the Character set used for current message.

Returns
string $_smtpsCharSet Character set used for current message

Definition at line 1075 of file smtps.class.php.

Referenced by getBodyContent().

◆ getDeliveryReceipt()

SMTPs::getDeliveryReceipt ( )

get delivery receipt

Returns
int Delivery receipt

Definition at line 340 of file smtps.class.php.

Referenced by getHeader().

◆ getErrors()

SMTPs::getErrors ( )

Returns applicative errors codes and messages for Class (not the SMTP error code)

Returns
string $_errMsg Error Message

Definition at line 2120 of file smtps.class.php.

◆ getErrorsTo()

SMTPs::getErrorsTo ( $_part = true)

Get errors to.

Parameters
true | string$_partVariant
Returns
string|array<string,string> Errors to

Definition at line 427 of file smtps.class.php.

Referenced by getHeader().

◆ getFrom()

SMTPs::getFrom ( $_part = true)

Retrieves the Address from which mail will be sent.

Parameters
true | string$_partTo "strip" 'Real name' from address
Returns
null|string|array{org:string,real?:string,addr:string,user:string,host:string} Address from which mail will be sent

Definition at line 1166 of file smtps.class.php.

Referenced by _server_authenticate(), and sendMsg().

◆ getHeader()

SMTPs::getHeader ( )

Constructs and returns message header.

Returns
string Complete message header

Definition at line 1542 of file smtps.class.php.

References $conf, getCC(), getDeliveryReceipt(), getErrorsTo(), getInReplyTo(), getMoreInHeader(), getPriority(), getReferences(), getReplyTo(), getSensitivity(), and getTrackId().

Referenced by sendMsg().

◆ getHost()

SMTPs::getHost ( )

Retrieves the Host Name or IP of the Mail Server to use This is used only with 'socket' based mail transmission.

Returns
string $_strHost Host Name or IP of the Mail Server to use

Definition at line 961 of file smtps.class.php.

Referenced by _server_authenticate(), _server_connect(), and sendMsg().

◆ getID()

SMTPs::getID ( )

Retrieves the User Name for authentication on Mail Server.

Returns
string User Name for authentication on Mail Server

Definition at line 1009 of file smtps.class.php.

◆ getInReplyTo()

SMTPs::getInReplyTo ( )

Retrieves the InReplyTo from which mail we reply to.

Returns
string Msg-Id of email we reply to

Definition at line 1229 of file smtps.class.php.

Referenced by getHeader().

◆ getMD5flag()

SMTPs::getMD5flag ( )

Gets flag which determines whether to calculate message MD5 checksum.

Returns
boolean MD5flag

Definition at line 1965 of file smtps.class.php.

Referenced by getBodyContent(), setAttachment(), setBodyContent(), and setImageInline().

◆ getMoreInHeader()

SMTPs::getMoreInHeader ( )

get moreInHeader

Returns
string moreInHeader

Definition at line 403 of file smtps.class.php.

Referenced by getHeader().

◆ getPort()

SMTPs::getPort ( )

Retrieves the Port Number of the Mail Server to use This is used only with 'socket' based mail transmission.

Returns
int Port Number of the Mail Server to use

Definition at line 988 of file smtps.class.php.

Referenced by _server_connect().

◆ getPriority()

SMTPs::getPriority ( )

Message Content Priority Message Priority values:

  • [0] 'Bulk'
  • [1] 'Highest'
  • [2] 'High'
  • [3] 'Normal' - default
  • [4] 'Low'
  • [5] 'Lowest'
Returns
string

Definition at line 1942 of file smtps.class.php.

Referenced by getHeader().

◆ getPW()

SMTPs::getPW ( )

Retrieves the User Password for authentication on Mail Server.

Returns
string User Password for authentication on Mail Server

Definition at line 1030 of file smtps.class.php.

◆ getReferences()

SMTPs::getReferences ( )

Retrieves the References from which mail will be the reply-to.

Returns
?string[] List of Msg-Id

Definition at line 1254 of file smtps.class.php.

Referenced by getHeader().

◆ getReplyTo()

SMTPs::getReplyTo ( $_part = true)

Retrieves the Address from which mail will be the reply-to.

Parameters
true | string$_partTo "strip" 'Real name' from address
Returns
null|array<string,string>|string Reply-To Address to use

Definition at line 1198 of file smtps.class.php.

Referenced by getHeader().

◆ getSensitivity()

SMTPs::getSensitivity ( )

Returns Message Content Sensitivity string Message Sensitivity values:

  • [0] None - default
  • [1] Personal
  • [2] Private
  • [3] Company Confidential
Returns
string|boolean

Definition at line 1904 of file smtps.class.php.

Referenced by getHeader().

◆ getSMTPTimeout()

SMTPs::getSMTPTimeout ( )

Get socket timeout.

Returns
int Delay in second for socket timeout

Definition at line 361 of file smtps.class.php.

◆ getSubject()

SMTPs::getSubject ( )

Retrieves the Message Subject.

Returns
string Message Subject

Definition at line 1532 of file smtps.class.php.

◆ getTo()

SMTPs::getTo ( )

Retrieves the TO Address[es] inwhich to send mail to.

Returns
string TO Address[es] inwhich to send mail to

Definition at line 1463 of file smtps.class.php.

References get_email_list().

Referenced by buildRCPTlist().

◆ getToken()

SMTPs::getToken ( )

Retrieves the User token for OAUTH2.

Returns
string User token for OAUTH2

Definition at line 1051 of file smtps.class.php.

◆ getTrackId()

SMTPs::getTrackId ( )

get trackid

Returns
string Track id

Definition at line 393 of file smtps.class.php.

Referenced by getHeader().

◆ getTransEncode()

SMTPs::getTransEncode ( )

Retrieves the Content-Transfer-Encoding.

Returns
string $_smtpsTransEncode Content-Transfer-Encoding

Definition at line 1107 of file smtps.class.php.

◆ getTransEncodeType()

SMTPs::getTransEncodeType ( )

Retrieves the Content-Transfer-Encoding.

Returns
string Content-Transfer-Encoding

Definition at line 1139 of file smtps.class.php.

◆ getTransportType()

SMTPs::getTransportType ( )

Return the method inwhich the message is to be sent.

  • 'sockets' [0] - connect via network to SMTP server
  • 'pipe [1] - use UNIX path to EXE
  • 'phpmail [2] - use the PHP built-in mail function
Returns
int $_strHost Host Name or IP of the Mail Server to use

Definition at line 921 of file smtps.class.php.

◆ getXheader()

SMTPs::getXheader ( )

Retrieves the Message X-Header Content.

Returns
string[] $_msgContent Message X-Header Content

Definition at line 1990 of file smtps.class.php.

◆ sendMsg()

◆ server_parse()

SMTPs::server_parse ( $socket,
$response )

This function has been modified as provided by SirSir to allow multiline responses when using SMTP Extensions.

Parameters
resource$socketSocket handler
string$responseExpected response ('250', ...). Example of response we can get: "421 4.7.0 Try again later, closing connection. (EHLO) nb21-20020a1709071c9500b0093d0d964affsm869534ejc.73 - gsmtp" "550 5.7.1 https://support.google.com/a/answer/6140680#invalidcred j21sm814390wre.3"
Returns
boolean True or false

Returns constructed SELECT Object string or boolean upon failure Default value is set at true

Definition at line 2036 of file smtps.class.php.

References _setErr().

Referenced by _server_connect(), and socket_send_str().

◆ setAttachment()

SMTPs::setAttachment ( $strContent,
$strFileName = 'unknown',
$strMimeType = 'unknown',
$strCid = '' )

File attachments are added to the content array as sub-arrays, allowing for multiple attachments for each outbound email.

Parameters
string$strContentFile data to attach to message
string$strFileNameFile Name to give to attachment
string$strMimeTypeFile Mime Type of attachment
string$strCidFile Cid of attachment (if defined, to be shown inline)
Returns
void

Definition at line 1830 of file smtps.class.php.

References dol_hash(), and getMD5flag().

◆ setBCC()

SMTPs::setBCC ( $_strBCC)

BCC Address[es] inwhich to send mail to.

Parameters
string$_strBCCRecipients BCC Address[es] inwhich to send mail to
Returns
void

Definition at line 1497 of file smtps.class.php.

References _buildAddrList().

◆ setBodyContent()

SMTPs::setBodyContent ( $strContent,
$strType = 'plain' )

Message Content.

Parameters
string$strContentMessage Content
string$strTypeType
Returns
void

Definition at line 1628 of file smtps.class.php.

References dol_hash(), and getMD5flag().

◆ setCC()

SMTPs::setCC ( $_strCC)

CC Address[es] inwhich to send mail to.

Parameters
string$_strCCCC Address[es] inwhich to send mail to
Returns
void

Definition at line 1474 of file smtps.class.php.

References _buildAddrList().

◆ setCharSet()

SMTPs::setCharSet ( $_strCharSet)

Character set used for current message Character set is defaulted to 'iso-8859-1';.

Parameters
string$_strCharSetCharacter set used for current message
Returns
void

Definition at line 1063 of file smtps.class.php.

◆ setConfig()

SMTPs::setConfig ( $_strConfigPath = null)

setConfig() is used to populate select class properties from either a user defined INI file or the systems 'php.ini' file

If a user defined INI is to be used, the files complete path is passed as the method single parameter. The INI can define any class and/or user properties. Only properties defined within this file will be setter and/or orverwritten

If the systems 'php.ini' file is to be used, the method is called without parameters. In this case, only HOST, PORT and FROM properties will be set as they are the only properties that are defined within the 'php.ini'.

If secure SMTP is to be used, the user ID and Password can be defined with the user INI file, but the properties are not defined with the systems 'php.ini'file, they must be defined via their setter methods

This method can be called twice, if desired. Once without a parameter to load the properties as defined within the systems 'php.ini' file, and a second time, with a path to a user INI file for other properties to be defined.

Parameters
mixed$_strConfigPathpath to config file or VOID
Returns
boolean

Returns constructed SELECT Object string or boolean upon failure Default value is set at true

Definition at line 860 of file smtps.class.php.

References _setErr(), setFrom(), setHost(), and setPort().

◆ setDebug()

SMTPs::setDebug ( $_vDebug = false)

Set debug.

Parameters
boolean$_vDebugValue for debug
Returns
void

Definition at line 446 of file smtps.class.php.

◆ setDeliveryReceipt()

SMTPs::setDeliveryReceipt ( $_val = 0)

Set delivery receipt.

Parameters
int$_valValue
Returns
void

Definition at line 330 of file smtps.class.php.

◆ setErrorsTo()

SMTPs::setErrorsTo ( $_strErrorsTo)

Set errors to.

Parameters
string$_strErrorsToErrors to
Returns
void

Definition at line 414 of file smtps.class.php.

References _strip_email().

◆ setFrom()

SMTPs::setFrom ( $_strFrom)

FROM Address from which mail will be sent.

Parameters
string$_strFromAddress from which mail will be sent
Returns
void

Definition at line 1153 of file smtps.class.php.

References _strip_email().

Referenced by setConfig().

◆ setHost()

SMTPs::setHost ( $_strHost)

Defines the Host Name or IP of the Mail Server to use.

This is defaulted to 'localhost' This is used only with 'socket' based mail transmission

Parameters
string$_strHostHost Name or IP of the Mail Server to use
Returns
void

Definition at line 948 of file smtps.class.php.

Referenced by setConfig().

◆ setID()

SMTPs::setID ( $_strID)

User Name for authentication on Mail Server.

Parameters
string$_strIDUser Name for authentication on Mail Server
Returns
void

Definition at line 999 of file smtps.class.php.

◆ setImageInline()

SMTPs::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 outbound email.

Parameters
string$strContentImage data to attach to message
string$strImageNameImage Name to give to attachment
string$strMimeTypeImage Mime Type of attachment
string$strImageCidCID
Returns
void

Definition at line 1859 of file smtps.class.php.

References dol_hash(), and getMD5flag().

◆ setInReplyTo()

SMTPs::setInReplyTo ( $_strInReplyTo)

Set References in the list of Msg-Id.

Parameters
string$_strInReplyToList of Msg-Id
Returns
void

Definition at line 1217 of file smtps.class.php.

◆ setMailPath()

SMTPs::setMailPath ( $_path)

Path to the sendmail executable.

Parameters
string$_pathPath to the sendmail executable
Returns
boolean

Definition at line 932 of file smtps.class.php.

◆ setMD5flag()

SMTPs::setMD5flag ( $_flag = false)

Set flag which determines whether to calculate message MD5 checksum.

Parameters
boolean$_flagMD5flag
Returns
void

Definition at line 1955 of file smtps.class.php.

◆ setMessageID()

SMTPs::setMessageID ( $_msgId = '')

Set Message-ID.

Parameters
string$_msgIdMessage-ID to use
Returns
void

Definition at line 308 of file smtps.class.php.

◆ setMoreInHeader()

SMTPs::setMoreInHeader ( $_val = '')

Set moreInHeader.

Parameters
string$_valValue
Returns
void

Definition at line 383 of file smtps.class.php.

◆ setOptions()

SMTPs::setOptions ( $_options = array())

Set options.

Parameters
array<string,array<string,mixed>>$_options An array of options for stream_context_create()
Returns
void

Definition at line 319 of file smtps.class.php.

◆ setPort()

SMTPs::setPort ( $_intPort)

Defines the Port Number of the Mail Server to use The default is 25 This is used only with 'socket' based mail transmission.

Parameters
int | string$_intPortPort Number of the Mail Server to use
Returns
void

Definition at line 974 of file smtps.class.php.

Referenced by setConfig().

◆ setPriority()

SMTPs::setPriority ( $_value = 3)

Message Content Priority Message Priority values:

  • [0] 'Bulk'
  • [1] 'Highest'
  • [2] 'High'
  • [3] 'Normal' - default
  • [4] 'Low'
  • [5] 'Lowest'
Parameters
integer$_valueMessage Priority
Returns
void

Definition at line 1922 of file smtps.class.php.

◆ setPW()

SMTPs::setPW ( $_strPW)

User Password for authentication on Mail Server.

Parameters
string$_strPWUser Password for authentication on Mail Server
Returns
void

Definition at line 1020 of file smtps.class.php.

◆ setReferences()

SMTPs::setReferences ( $_strReferences)

Set References in the list of Msg-Id.

Parameters
string[]$_strReferencesList of Msg-Id
Returns
void

Definition at line 1242 of file smtps.class.php.

◆ setReplyTo()

SMTPs::setReplyTo ( $_strReplyTo)

Reply-To Address from which mail will be the reply-to.

Parameters
string$_strReplyToAddress from which mail will be the reply-to
Returns
void

Definition at line 1185 of file smtps.class.php.

References _strip_email().

◆ setSensitivity()

SMTPs::setSensitivity ( $_value = 0)

Message Content Sensitivity Message Sensitivity values:

  • [0] None - default
  • [1] Personal
  • [2] Private
  • [3] Company Confidential
Parameters
integer$_valueMessage Sensitivity
Returns
void

Definition at line 1886 of file smtps.class.php.

◆ setSMTPTimeout()

SMTPs::setSMTPTimeout ( $timeout)

Set socket timeout.

May be increase when email sent after a long time and with a large file for the wake up of SMTP server.

Parameters
int$timeoutDelay in second for socket timeout (default is 10s)
Returns
void

Definition at line 351 of file smtps.class.php.

◆ setSubject()

SMTPs::setSubject ( $_strSubject = '')

Message Subject.

Parameters
string$_strSubjectMessage Subject
Returns
void

Definition at line 1520 of file smtps.class.php.

◆ setTO()

SMTPs::setTO ( $_addrTo)

TO Address[es] inwhich to send mail to.

Parameters
string$_addrToTO Address[es] inwhich to send mail to
Returns
void

Definition at line 1451 of file smtps.class.php.

References _buildAddrList().

◆ setToken()

SMTPs::setToken ( $_strToken)

User token for OAUTH2.

Parameters
string$_strTokenUser token
Returns
void

Definition at line 1041 of file smtps.class.php.

◆ setTrackId()

SMTPs::setTrackId ( $_val = '')

Set trackid.

Parameters
string$_valValue
Returns
void

Definition at line 372 of file smtps.class.php.

◆ setTransEncode()

SMTPs::setTransEncode ( $_strTransEncode)

Content-Transfer-Encoding, Defaulted to '7bit' This can be changed for 2byte characters sets Known Encode Types.

  • 7bit Simple 7-bit ASCII
  • 8bit 8-bit coding with line termination characters
  • base64 3 octets encoded into 4 sextets with offset
  • binary Arbitrary binary stream
  • mac-binhex40 Macintosh binary to hex encoding
  • quoted-printable Mostly 7-bit, with 8-bit characters encoded as "=HH"
  • uuencode UUENCODE encoding
Parameters
string$_strTransEncodeContent-Transfer-Encoding
Returns
void

Definition at line 1095 of file smtps.class.php.

◆ setTransEncodeType()

SMTPs::setTransEncodeType ( $_strTransEncodeType)

Content-Transfer-Encoding, Defaulted to '0' [ZERO] This can be changed for 2byte characters sets Known Encode Types.

  • [0] 7bit Simple 7-bit ASCII
  • [1] 8bit 8-bit coding with line termination characters
  • [2] base64 3 octets encoded into 4 sextets with offset
  • [3] binary Arbitrary binary stream
  • [4] mac-binhex40 Macintosh binary to hex encoding
  • [5] quoted-printable Mostly 7-bit, with 8-bit characters encoded as "=HH"
  • [6] uuencode UUENCODE encoding
Parameters
string$_strTransEncodeTypeContent-Transfer-Encoding
Returns
void

Definition at line 1127 of file smtps.class.php.

◆ setTransportType()

SMTPs::setTransportType ( $_type = 0)

Determines the method inwhich the messages are to be sent.

  • 'sockets' [0] - connect via network to SMTP server
  • 'pipe [1] - use UNIX path to EXE
  • 'phpmail [2] - use the PHP built-in mail function
Parameters
int$_typeInteger value representing Mail Transport Type
Returns
void

Definition at line 906 of file smtps.class.php.

◆ setXheader()

SMTPs::setXheader ( $strXdata)

Message X-Header Content This is a simple "insert".

Whatever is given will be placed "as is" into the Xheader array.

Parameters
string$strXdataMessage X-Header Content
Returns
void

Definition at line 1978 of file smtps.class.php.

◆ socket_send_str()

SMTPs::socket_send_str ( $_strSend,
$_returnCode = null,
$CRLF = "\r\n" )

Send str.

Parameters
string$_strSendString to send
string$_returnCodeExpected return code
string$CRLFCRLF
Returns
boolean|null True or false

Definition at line 2079 of file smtps.class.php.

References server_parse().

Referenced by _server_authenticate(), and sendMsg().


The documentation for this class was generated from the following file: