Constants

USE_EXCEPTIONS

USE_EXCEPTIONS = null : bool|null

Whether or not to initialize the PHPMailer object to throw exceptions.

Overload this constant in a concrete test class and set the value to true to initialize PHPMailer with Exceptions turned on.

Properties

$propertyChanges

$propertyChanges : array

Property names and their values for the test instance of the PHPMailer class.

These (public) properties will be set in the set_up() method.

This property can be enhanced/overloaded in concrete test classes to change the presets or add additional properties.

It is the responsibility of the individual test classes to ensure that property values of the correct type are passed.

Type

array — Key is the property name, value the desired value for the PHPMailer instance.

$Mail

$Mail : \PHPMailer\PHPMailer\PHPMailer

Holds the PHPMailer instance.

Type

PHPMailer

$requestKeys

$requestKeys : array

Translation map for supported $REQUEST keys to the property name in the PHPMailer class.

Type

array

$ChangeLog

$ChangeLog : string[]

Holds the change log.

Type

string[]

$NoteLog

$NoteLog : string[]

Holds the note log.

Type

string[]

$changelogExclude

$changelogExclude

$PHPMailerStaticProps

$PHPMailerStaticProps : array

List of *static* properties in the PHPMailer class which _may_ be changed from within a test, with their default values.

This list is used by the {@see TestCase::resetStaticProperties()} method, as well as in the {@see TestCase::checkChanges()} method.

Type

array — Key is the property name, value the default as per the PHPMailer class.

$Smtp

$Smtp

Methods

set_up_before_class()

set_up_before_class() : mixed

Run before each test class.

Returns

mixed —

updateStaticProperty()

updateStaticProperty(string  $className, string  $propertyName, mixed  $value) : mixed

Update the value of a - potentially inaccessible - static property in a class.

Parameters

string $className

The target class.

string $propertyName

The name of the static property.

mixed $value

The new value for the property.

Returns

mixed —

testLowPriority()

testLowPriority() : mixed

Test low priority.

Returns

mixed —

testMultiplePlainFileAttachment()

testMultiplePlainFileAttachment() : mixed

Simple plain file attachment test.

Returns

mixed —

testRejectNonLocalFileAttachment()

testRejectNonLocalFileAttachment() : mixed

Rejection of non-local file attachments test.

Returns

mixed —

testQuotedPrintable()

testQuotedPrintable() : mixed

Plain quoted-printable message.

Returns

mixed —

testHeaderEncoding()

testHeaderEncoding() : mixed

Test header encoding & folding.

Returns

mixed —

testHtml()

testHtml() : mixed

Send an HTML message.

Returns

mixed —

testDsn()

testDsn() : mixed

Send an HTML message specifying the DSN notifications we expect.

Returns

mixed —

testCreateBody()

testCreateBody() : mixed

createBody test of switch case

Returns

mixed —

testHtmlIso8859()

testHtmlIso8859() : mixed

Send a message containing ISO-8859-1 text.

Returns

mixed —

testHtmlUtf8()

testHtmlUtf8() : mixed

Send a message containing multilingual UTF-8 text.

Returns

mixed —

testUtf8WithEmbeddedImage()

testUtf8WithEmbeddedImage() : mixed

Send a message containing multilingual UTF-8 text with an embedded image.

Returns

mixed —

testPlainUtf8()

testPlainUtf8() : mixed

Send a message containing multilingual UTF-8 text.

Returns

mixed —

testMsgHTML()

testMsgHTML() : mixed

Test simple message builder and html2text converters.

Returns

mixed —

testHTMLAttachment()

testHTMLAttachment() : mixed

Simple HTML and attachment test.

Returns

mixed —

testAttachmentNaming()

testAttachmentNaming() : mixed

Attachment naming test.

Returns

mixed —

testHTMLMultiAttachment()

testHTMLMultiAttachment() : mixed

Simple HTML and multiple attachment test.

Returns

mixed —

testEmbeddedImage()

testEmbeddedImage() : mixed

An embedded attachment test.

Returns

mixed —

testMultiEmbeddedImage()

testMultiEmbeddedImage() : mixed

An embedded attachment test.

Returns

mixed —

testAltBody()

testAltBody() : mixed

Simple multipart/alternative test.

Returns

mixed —

testAltBodyAttachment()

testAltBodyAttachment() : mixed

Simple HTML and attachment test.

Returns

mixed —

testMultipleSend()

testMultipleSend() : mixed

Test sending multiple messages with separate connections.

Returns

mixed —

testEmptyBody()

testEmptyBody() : mixed

Test sending an empty body.

Returns

mixed —

testSmtpKeepAlive()

testSmtpKeepAlive() : mixed

Test keepalive (sending multiple messages in a single connection).

Returns

mixed —

testAddressing()

testAddressing() : mixed

Test addressing.

Returns

mixed —

testAddressEscaping()

testAddressEscaping() : mixed

Test address escaping.

Returns

mixed —

testMIMEStructure()

testMIMEStructure() : mixed

Test MIME structure assembly.

Returns

mixed —

testBCCAddressing()

testBCCAddressing() : mixed

Test BCC-only addressing.

Returns

mixed —

testAddAttachmentEncodingException()

testAddAttachmentEncodingException() : mixed

Expect exceptions on bad encoding

Returns

mixed —

testDeletedAttachmentException()

testDeletedAttachmentException() : mixed

Expect exceptions on sending after deleting a previously successfully attached file

Returns

mixed —

testDeletedAttachmentError()

testDeletedAttachmentError() : mixed

Expect error on sending after deleting a previously successfully attached file

Returns

mixed —

testBase64()

testBase64() : mixed

Test base-64 encoding.

Returns

mixed —

testSigning()

testSigning() : mixed

S/MIME Signing tests (self-signed).

Returns

mixed —

testSigningWithCA()

testSigningWithCA() : mixed

S/MIME Signing tests using a CA chain cert.

To test that a generated message is signed correctly, save the message in a file called signed.eml and use openssl along with the certs generated by this script: openssl smime -verify -in signed.eml -signer certfile.pem -CAfile cacertfile.pem.

Returns

mixed —

testLineBreaks()

testLineBreaks() : mixed

Test line break reformatting.

Returns

mixed —

testMiscellaneous()

testMiscellaneous() : mixed

Miscellaneous calls to improve test coverage and some small tests.

Returns

mixed —

testBadSMTP()

testBadSMTP() : mixed

Returns

mixed —

testConfirmReadingTo()

testConfirmReadingTo() : mixed

Tests setting and retrieving ConfirmReadingTo address, also known as "read receipt" address.

Returns

mixed —

testConvertEncoding()

testConvertEncoding() : mixed

Tests CharSet and Unicode -> ASCII conversions for addresses with IDN.

Returns

mixed —

testDuplicateIDNRemoved()

testDuplicateIDNRemoved() : mixed

Tests removal of duplicate recipients and reply-tos.

Returns

mixed —

testSmtpConnect()

testSmtpConnect() : mixed

Test SMTP host connections.

This test can take a long time, so run it last.

Returns

mixed —

testGivenIdnAddress_addAddress_returns_true()

testGivenIdnAddress_addAddress_returns_true() : mixed

Returns

mixed —

testErroneousAddress_addAddress_returns_false()

testErroneousAddress_addAddress_returns_false() : mixed

Returns

mixed —

set_up()

set_up() : mixed

Run before each test is started.

Returns

mixed —

tear_down()

tear_down() : mixed

Run after each test is completed.

Returns

mixed —

resetStaticProperties()

resetStaticProperties() : mixed

Reset the static properties in the PHPMailer class to their default values.

Returns

mixed —

buildBody()

buildBody() : mixed

Build the body of the message in the appropriate format.

Returns

mixed —

checkChanges()

checkChanges() : mixed

Check which default settings have been changed for the report.

Returns

mixed —

addChange()

addChange(string  $sName, string  $sNewValue) : mixed

Add a changelog entry.

Parameters

string $sName
string $sNewValue

Returns

mixed —

addNote()

addNote(string  $sValue) : mixed

Adds a simple note to the message.

Parameters

string $sValue

Returns

mixed —

setAddress()

setAddress(string  $sAddress, string  $sName = '', string  $sType = 'to') : bool

Adds all of the addresses.

Parameters

string $sAddress
string $sName
string $sType

Returns

bool —