include/SugarPHPMailer.php
\SugarPHPMailer
Sugar mailer
- Parent(s)
- \PHPMailer
- Api
Properties

string
$AltBody= ''''
Sets the text-only body of the message. This automatically sets the email to multipart/alternative. This body can be read by mail clients that do not have HTML email capability such as mutt. Clients that can read HTML will view the normal Body.
Inherited from: \PHPMailer::$$AltBody''Details- Type
- string
- Inherited_from
- \PHPMailer::$$AltBody

string
$Body= ''''
Sets the Body of the message. This can be either an HTML or text body.
Inherited from: \PHPMailer::$$Body
string
$CharSet= ''utf-8''
'utf-8'Details- Type
- string
- Inherited_from
- \PHPMailer::$$CharSet

string
$ConfirmReadingTo= ''''
Sets the email address that a reading confirmation will be sent.
Inherited from: \PHPMailer::$$ConfirmReadingTo''Details- Type
- string
- Inherited_from
- \PHPMailer::$$ConfirmReadingTo

string
$ContentType= ''text/plain''
'text/plain'Details- Type
- string
- Inherited_from
- \PHPMailer::$$ContentType

$CustomHeader= 'array()'
array()Details- Type
- n/a
- Inherited_from
- \PHPMailer::$$CustomHeader

string
$Encoding= ''8bit''
Sets the Encoding of the message. Options for this are "8bit", "7bit", "binary", "base64", and "quoted-printable".
Inherited from: \PHPMailer::$$Encoding'8bit'Details- Type
- string
- Inherited_from
- \PHPMailer::$$Encoding

string
$From= ''root@localhost''
'root@localhost'Details- Type
- string
- Inherited_from
- \PHPMailer::$$From

string
$FromName= ''Root User''
'Root User'Details- Type
- string
- Inherited_from
- \PHPMailer::$$FromName

string
$Helo= ''''
Sets the SMTP HELO of the message (Default is $Hostname).
Inherited from: \PHPMailer::$$Helo''Details- Type
- string
- Inherited_from
- \PHPMailer::$$Helo

string
$Host= ''localhost''
Sets the SMTP hosts. All hosts must be separated by a semicolon. You can also specify a different port for each host by using this format: [hostname:port] (e.g. "smtp1.example.com:25;smtp2.example.com").
Inherited from: \PHPMailer::$$HostHosts will be tried in order.
'localhost'Details- Type
- string
- Inherited_from
- \PHPMailer::$$Host

string
$Hostname= ''''
Sets the hostname to use in Message-Id and Received headers and as default HELO string. If empty, the value returned by SERVER_NAME is used or 'localhost.localdomain'.
Inherited from: \PHPMailer::$$Hostname''Details- Type
- string
- Inherited_from
- \PHPMailer::$$Hostname

string
$MessageID= ''''
Sets the message ID to be used in the Message-Id header.
Inherited from: \PHPMailer::$$MessageIDIf empty, a unique id will be generated.
''Details- Type
- string
- Inherited_from
- \PHPMailer::$$MessageID

string
$PluginDir= ''include/phpmailer/''
Path to PHPMailer plugins. This is now only useful if the SMTP class is in a different directory than the PHP include path.
Inherited from: \PHPMailer::$$PluginDir'include/phpmailer/'Details- Type
- string
- Inherited_from
- \PHPMailer::$$PluginDir

$ReplyTo= 'array()'
array()Details- Type
- n/a
- Inherited_from
- \PHPMailer::$$ReplyTo

bool
$SMTPAuth= 'false'
Sets SMTP authentication. Utilizes the Username and Password variables.
Inherited from: \PHPMailer::$$SMTPAuthfalseDetails- Type
- bool
- Inherited_from
- \PHPMailer::$$SMTPAuth

bool
$SMTPKeepAlive= 'false'
Prevents the SMTP connection from being closed after each mail sending. If this is set to true then to close the connection requires an explicit call to SmtpClose().
Inherited from: \PHPMailer::$$SMTPKeepAlivefalseDetails- Type
- bool
- Inherited_from
- \PHPMailer::$$SMTPKeepAlive

string
$SMTPSecure= '""'
Options are "", "ssl" or "tls"
""Details- Type
- string
- Inherited_from
- \PHPMailer::$$SMTPSecure

string
$Sender= ''''
Sets the Sender email (Return-Path) of the message. If not empty, will be sent via -f to sendmail or as 'MAIL FROM' in smtp mode.
Inherited from: \PHPMailer::$$Sender''Details- Type
- string
- Inherited_from
- \PHPMailer::$$Sender

string
$Sendmail= ''/usr/sbin/sendmail''
'/usr/sbin/sendmail'Details- Type
- string
- Inherited_from
- \PHPMailer::$$Sendmail

bool
$SingleTo= 'false'
Provides the ability to have the TO field process individual emails, instead of sending to entire TO addresses
Inherited from: \PHPMailer::$$SingleTofalseDetails- Type
- bool
- Inherited_from
- \PHPMailer::$$SingleTo

int
$Timeout= '10'
Sets the SMTP server timeout in seconds. This function will not work with the win32 version.
Inherited from: \PHPMailer::$$Timeout10Details- Type
- int
- Inherited_from
- \PHPMailer::$$Timeout

int
$WordWrap= '0'
Sets word wrapping on the body of the message to a given number of characters.
Inherited from: \PHPMailer::$$WordWrap0Details- Type
- int
- Inherited_from
- \PHPMailer::$$WordWrap

$attachment= 'array()'
array()Details- Type
- n/a
- Inherited_from
- \PHPMailer::$$attachment

$bcc= 'array()'
array()Details- Type
- n/a
- Inherited_from
- \PHPMailer::$$bcc

$boundary= 'array()'
array()Details- Type
- n/a
- Inherited_from
- \PHPMailer::$$boundary

$cc= 'array()'
array()Details- Type
- n/a
- Inherited_from
- \PHPMailer::$$cc

$error_count= '0'
0Details- Type
- n/a
- Inherited_from
- \PHPMailer::$$error_count

$language= 'array()'
array()Details- Type
- n/a
- Inherited_from
- \PHPMailer::$$language

$message_type= ''''
''Details- Type
- n/a
- Inherited_from
- \PHPMailer::$$message_type

$sign_cert_file= '""'
""Details- Type
- n/a
- Inherited_from
- \PHPMailer::$$sign_cert_file

$sign_key_file= '""'
""Details- Type
- n/a
- Inherited_from
- \PHPMailer::$$sign_key_file

$sign_key_pass= '""'
""Details- Type
- n/a
- Inherited_from
- \PHPMailer::$$sign_key_pass

$smtp= 'NULL'
NULLDetails- Type
- n/a
- Inherited_from
- \PHPMailer::$$smtp

$to= 'array()'
array()Details- Type
- n/a
- Inherited_from
- \PHPMailer::$$to
Methods

AddAddress(
string $address, string $name
=
''
)
:
void
| Name | Type | Description |
|---|---|---|
| $address | string | |
| $name | string |

AddAttachment(
string $path, string $name
=
'', string $encoding
=
'base64', string $type
=
'application/octet-stream'
)
:
boolAdds an attachment from a path on the filesystem.
Inherited from: \PHPMailer::AddAttachment()Returns false if the file could not be found or accessed.
| Name | Type | Description |
|---|---|---|
| $path | string | Path to the attachment. |
| $name | string | Overrides the attachment name. |
| $encoding | string | File encoding (see $Encoding). |
| $type | string | File extension (MIME) type. |
| Type | Description |
|---|---|
| bool |

AddBCC(
string $address, string $name
=
''
)
:
voidAdds a "Bcc" address. Note: this function works with the SMTP mailer on win32, not with the "mail" mailer.
Inherited from: \PHPMailer::AddBCC()| Name | Type | Description |
|---|---|---|
| $address | string | |
| $name | string |

AddCC(
string $address, string $name
=
''
)
:
voidAdds a "Cc" address. Note: this function works with the SMTP mailer on win32, not with the "mail" mailer.
Inherited from: \PHPMailer::AddCC()| Name | Type | Description |
|---|---|---|
| $address | string | |
| $name | string |

AddCustomHeader(
$custom_header
)
:
void
| Name | Type | Description |
|---|---|---|
| $custom_header |
- Access
- public

AddEmbeddedImage(
string $path, string $cid, string $name
=
'', string $encoding
=
'base64', string $type
=
'application/octet-stream'
)
:
boolAdds an embedded attachment. This can include images, sounds, and just about any other document. Make sure to set the $type to an image type. For JPEG images use "image/jpeg" and for GIF images use "image/gif".
Inherited from: \PHPMailer::AddEmbeddedImage()| Name | Type | Description |
|---|---|---|
| $path | string | Path to the attachment. |
| $cid | string | Content ID of the attachment. Use this to identify the Id for accessing the image in an HTML form. |
| $name | string | Overrides the attachment name. |
| $encoding | string | File encoding (see $Encoding). |
| $type | string | File extension (MIME) type. |
| Type | Description |
|---|---|
| bool |

AddReplyTo(
string $address, string $name
=
''
)
:
void
| Name | Type | Description |
|---|---|---|
| $address | string | |
| $name | string |

AddStringAttachment(
string $string, string $filename, string $encoding
=
'base64', string $type
=
'application/octet-stream'
)
:
voidAdds a string or binary attachment (non-filesystem) to the list.
Inherited from: \PHPMailer::AddStringAttachment()This method can be used to attach ascii or binary data, such as a BLOB record from a database.
| Name | Type | Description |
|---|---|---|
| $string | string | String attachment data. |
| $filename | string | Name of the attachment. |
| $encoding | string | File encoding (see $Encoding). |
| $type | string | File extension (MIME) type. |

AddrAppend(
$type, $addr
)
:
string
| Name | Type | Description |
|---|---|---|
| $type | ||
| $addr |
| Type | Description |
|---|---|
| string |
- Access
- public

AddrFormat(
$addr
)
:
string
| Name | Type | Description |
|---|---|---|
| $addr |
| Type | Description |
|---|---|
| string |
- Access
- public

AttachAll(
)
:
stringAttaches all fs, string, and binary attachments to the message.
Returns an empty string on failure.
| Type | Description |
|---|---|
| string |
- Access
- private

Base64EncodeWrapMB(
string $str
)
:
stringCorrectly encodes and wraps long multibyte strings for mail headers without breaking lines within a character.
Inherited from: \PHPMailer::Base64EncodeWrapMB()Adapted from a function by paravoid at http://uk.php.net/manual/en/function.mb-encode-mimeheader.php
| Name | Type | Description |
|---|---|---|
| $str | string | multi-byte text to wrap encode |
| Type | Description |
|---|---|
| string |
- Access
- public

ClearAddresses(
)
:
voidClears all recipients assigned in the TO array. Returns void.
Inherited from: \PHPMailer::ClearAddresses()
ClearAllRecipients(
)
:
voidClears all recipients assigned in the TO, CC and BCC array. Returns void.
Inherited from: \PHPMailer::ClearAllRecipients()
ClearAttachments(
)
:
voidClears all previously set filesystem, string, and binary attachments. Returns void.
Inherited from: \PHPMailer::ClearAttachments()
ClearBCCs(
)
:
voidClears all recipients assigned in the BCC array. Returns void.
Inherited from: \PHPMailer::ClearBCCs()
ClearCCs(
)
:
voidClears all recipients assigned in the CC array. Returns void.
Inherited from: \PHPMailer::ClearCCs()
ClearReplyTos(
)
:
voidClears all recipients assigned in the ReplyTo array. Returns void.
Inherited from: \PHPMailer::ClearReplyTos()
CreateBody(
)
:
stringAssembles the message body. Returns an empty string on failure.
Inherited from: \PHPMailer::CreateBody()| Type | Description |
|---|---|
| string |
- Access
- public

EncodeFile(
$path, $encoding
=
'base64'
)
:
stringEncodes attachment in requested format. Returns an empty string on failure.
Inherited from: \PHPMailer::EncodeFile()| Name | Type | Description |
|---|---|---|
| $path | ||
| $encoding |
| Type | Description |
|---|---|
| string |
- Access
- public

EncodeHeader(
$str, $position
=
'text'
)
:
stringEncode a header string to best of Q, B, quoted or none.
Inherited from: \PHPMailer::EncodeHeader()| Name | Type | Description |
|---|---|---|
| $str | ||
| $position |
| Type | Description |
|---|---|
| string |
- Access
- public

EncodeQ(
$str, $position
=
'text'
)
:
string
| Name | Type | Description |
|---|---|---|
| $str | ||
| $position |
| Type | Description |
|---|---|
| string |
- Access
- public

EncodeQP(
$input
=
'', integer $line_max
=
76, $space_conv
=
false
)
:
string
| Name | Type | Description |
|---|---|---|
| $input | ||
| $line_max | integer | Number of chars allowed on a line before wrapping |
| $space_conv |
| Type | Description |
|---|---|
| string |
- Access
- public

EncodeString(
$str, $encoding
=
'base64'
)
:
stringEncodes string to requested format. Returns an empty string on failure.
Inherited from: \PHPMailer::EncodeString()| Name | Type | Description |
|---|---|---|
| $str | ||
| $encoding |
| Type | Description |
|---|---|
| string |
- Access
- public

FixEOL(
$str
)
:
string
| Name | Type | Description |
|---|---|---|
| $str |
| Type | Description |
|---|---|
| string |
- Access
- private

GetBoundary(
$boundary, $charSet, $contentType, $encoding
)
:
void
| Name | Type | Description |
|---|---|---|
| $boundary | ||
| $charSet | ||
| $contentType | ||
| $encoding |
- Access
- public

HasMultiBytes(
string $str
)
:
boolChecks if a string contains multibyte characters.
Inherited from: \PHPMailer::HasMultiBytes()| Name | Type | Description |
|---|---|---|
| $str | string | multi-byte text to wrap encode |
| Type | Description |
|---|---|
| bool |
- Access
- public

HeaderLine(
$name, $value
)
:
void| Name | Type | Description |
|---|---|---|
| $name | ||
| $value |

InlineImageExists(
)
:
boolReturns true if an inline attachment is present.
Inherited from: \PHPMailer::InlineImageExists()| Type | Description |
|---|---|
| bool |
- Access
- public

IsMail(
)
:
voidSets Mailer to send message using PHP mail() function.
Inherited from: \PHPMailer::IsMail()
IsSendmail(
)
:
voidSets Mailer to send message using the $Sendmail program.
Inherited from: \PHPMailer::IsSendmail()
Lang(
$key
)
:
string
| Name | Type | Description |
|---|---|---|
| $key |
| Type | Description |
|---|---|
| string |
- Access
- private

MailSend(
$header, $body
)
:
bool
| Name | Type | Description |
|---|---|---|
| $header | ||
| $body |
| Type | Description |
|---|---|
| bool |
- Access
- public

MsgHTML(
$message, $basedir
=
''
)
:
\$messageEvaluates the message and returns modifications for inline images and backgrounds
Inherited from: \PHPMailer::MsgHTML()| Name | Type | Description |
|---|---|---|
| $message | ||
| $basedir |
| Type | Description |
|---|---|
| \$message |
- Access
- public

SecureHeader(
string $str
)
:
string
| Name | Type | Description |
|---|---|---|
| $str | string | String |
| Type | Description |
|---|---|
| string |
- Access
- public

Send(
)
:
boolCreates message and assigns Mailer. If the message is not sent successfully then it returns false. Use the ErrorInfo variable to view description of the error.
Inherited from: \PHPMailer::Send()| Type | Description |
|---|---|
| bool |

SendmailSend(
$header, $body
)
:
bool
| Name | Type | Description |
|---|---|---|
| $header | ||
| $body |
| Type | Description |
|---|---|
| bool |
- Access
- public

ServerHostname(
)
:
stringReturns the server hostname or 'localhost.localdomain' if unknown.
Inherited from: \PHPMailer::ServerHostname()| Type | Description |
|---|---|
| string |
- Access
- private

SetError(
$msg
)
:
voidoverloads class.phpmailer's SetError() method so that we can log errors in sugarcrm.log
Returns void.
| Name | Type | Description |
|---|---|---|
| $msg |

SetLanguage(
string $lang_type
=
'en', string $lang_path
=
'language/'
)
:
boolSets the language for all class error messages. Returns false if it cannot load the language file. The default language type is English.
Inherited from: \PHPMailer::SetLanguage()| Name | Type | Description |
|---|---|---|
| $lang_type | string | Type of language (e.g. Portuguese: "br") |
| $lang_path | string | Path to the language file directory |
| Type | Description |
|---|---|
| bool |
- Access
- public

Sign(
$cert_filename, string $key_filename, string $key_pass
)
:
voidSet the private key file and password to sign the message.
Inherited from: \PHPMailer::Sign()| Name | Type | Description |
|---|---|---|
| $cert_filename | ||
| $key_filename | string | Parameter File Name |
| $key_pass | string | Password for private key |
- Access
- public

SmtpConnect(
)
:
boolInitiates a connection to an SMTP server. Returns false if the operation failed.
| Type | Description |
|---|---|
| bool |

SmtpSend(
$header, $body
)
:
boolSends mail via SMTP using PhpSMTP (Author: Chris Ryan). Returns bool. Returns false if there is a bad MAIL FROM, RCPT, or DATA input.
Inherited from: \PHPMailer::SmtpSend()| Name | Type | Description |
|---|---|---|
| $header | ||
| $body |
| Type | Description |
|---|---|
| bool |
- Access
- public

TextLine(
$value
)
:
string
| Name | Type | Description |
|---|---|---|
| $value |
| Type | Description |
|---|---|
| string |
- Access
- public

UTF8CharBoundary(
string $encodedText, int $maxLength
)
:
intFinds last character boundary prior to maxLength in a utf-8 quoted (printable) encoded string.
Inherited from: \PHPMailer::UTF8CharBoundary()Original written by Colin Brown.
| Name | Type | Description |
|---|---|---|
| $encodedText | string | utf-8 QP text |
| $maxLength | int | find last character boundary prior to this length |
| Type | Description |
|---|---|
| int |
- Access
- public

WrapText(
$message, $length, $qp_mode
=
false
)
:
stringWraps message for use with mailers that do not automatically perform wrapping and for quoted-printable.
Inherited from: \PHPMailer::WrapText()Original written by philippe.
| Name | Type | Description |
|---|---|---|
| $message | ||
| $length | ||
| $qp_mode |
| Type | Description |
|---|---|
| string |
- Access
- public

_mime_types(
$ext
=
''
)
:
\mimeGets the mime type of the embedded or inline image
Inherited from: \PHPMailer::_mime_types()| Name | Type | Description |
|---|---|---|
| $ext |
| Type | Description |
|---|---|
| \mime | type of ext |
- Access
- public

getFile(
string $filename
)
:
void
| Name | Type | Description |
|---|---|---|
| $filename | string | Parameter File Name |
- Access
- public

handleAttachments(
\notes $notes
)
:
void| Name | Type | Description |
|---|---|---|
| $notes | \notes | array of note beans |

replaceImageByRegex(
string $regex, string $local_prefix, bool $object
=
false
)
:
voidReplace images with locations specified by regex with cid: images and attach needed files
| Name | Type | Description |
|---|---|---|
| $regex | string | Regular expression |
| $local_prefix | string | Prefix where local files are stored |
| $object | bool | Use attachment object |

set(
string $name, mixed $value
=
''
)
:
void
Usage Example: $page->set('X-Priority', '3');
| Name | Type | Description |
|---|---|---|
| $name | string | Parameter Name |
| $value | mixed | Parameter Value NOTE: will not work with arrays, there are no arrays to set/reset |
- Access
- public